#development
1 messages ¡ Page 1842 of 1
i have this little array setup and want to check if an id is in there: js if(gifusers.indexOf(pingeduser.id)){ return message.channel.send("test") } Why is indexOf not a function?
tf was that
well
an easier thing to use would be includes
it returns true/false depending on if the value given to the includes method exists in the array
and also indexOf as far as I know only works on arrays and strings not json
so when trying to register slash commands i get the error no permission and I use this invite: discord.com/oauth2/authorize?client_id=<no id for you>&scope=bot+applications.commands&permissions=8 and my bot has every permission, idk whats wrong
In js
yup i am dumb. I am sorry.
If the object.length == 1, why is it not removing the last id? from an object
What
just dont give it one
smart asf mistty
Can someone help me
(maybe) because permissions go before scope
i doubt that'd change anything but đ¤ˇ
no bot gets scope and permissions
what?
const messageCreate = require('./events/guild/messageCreate');
module.exports = {
async execute(client, message){
localisedCommands = [{name: 'ping',description: 'Pong!'}]
let GUILD_ID = "7754892982200565830"
let CLIENT_ID = client.user.id
await client.application?.commands.set(localisedCommands, GUILD_ID)
console.log("[BOT-EVENTS] : Bot commands updated successfully!")
message.channel.send("Updated successfully!")
}
}
code
what's the full error?
N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\rest\RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async ApplicationCommandManager.set (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\managers\ApplicationCommandManager.js:146:18)
at async Object.execute (N:\Desktop\Stealth Dynamics Bot\register.js:17:13) {
method: 'put',
path: '/applications/874990390900576326/guilds/7754892982200565830/commands',
code: 50001,
httpStatus: 403,
requestData: {
json: [
{
name: 'ping',
description: 'Pong!',
type: undefined,
options: undefined,
default_permission: undefined
}
],
files: []
}
}
Doesnt the bot need permissions in that specific guild
its got it
But if it has Administrator then ig it doesn't matter
Missing application commands scope
that's not the permission
nope
He has it
you need the scope not permission
try reinviting it
Ahh alright just guessing u know
ive done 16 times
I needed to reinvite the bot, too
still no fix
Well
WeirdâŚ
You could try asking in the d.js server
no response
Try to create another test guild
make sure you have the correct guild ID too
I am
lmao
i do
That guild ID is suspicious long
Accidentally added an extra char?
yep

Then it worked
im on the appppppp
Oh nvm
yeah even the creation itself threw up
const fs = require('fs');
const Discord = require('discord.js')
const config = require('./config.json');
const messageCreate = require('./events/guild/messageCreate');
module.exports = {
async execute(client, message){
localisedCommands = [{name: 'ping',description: 'Pong!'}]
let GUILD_ID = "754892982200565830"
let CLIENT_ID = client.user.id
await client.application?.commands.set(localisedCommands, GUILD_ID)
console.log("[BOT-EVENTS] : Bot commands updated successfully!")
message.channel.send("Updated successfully!")
}
}
the commands look fine
No error?
that is a REST request
just not one you formed yourself
self-control
they provided a guild ID though
yea
you can provide a guild id and it sets it for the guild
the discordjs guide is weird though
they dont even bother using that
Set returns a promise
Though tim I have a feeling it is still trying to register a global command
or they are doing something wrong
no
Put a catch in there to see if an error occurs
dont work
Yes there is
wdym dont work
No error, jsut does not work
if an error occured it would throw an unhandled rejection
no error
have you tried reloading your discord app?
If he doesnât suppress them 
i believe someone had that problem
and it turned out they needed to refresh their discord to see the changes
Well I had this issue too but on the browser bc of the cache
every time after the bot says it did it right
Yeah I know heâs using the appâŚ
Here is the console.log for my set command
Collection(1) [Map] {
'875132306338226218' => <ref *1> ApplicationCommand {
id: '875132306338226218',
applicationId: '874990390900576326',
guild: Guild {
id: '754892982200565830',
name: 'Stuff',
icon: null,
features: [],
commands: [GuildApplicationCommandManager],
members: [GuildMemberManager],
channels: [GuildChannelManager],
bans: [GuildBanManager],
roles: [RoleManager],
presences: PresenceManager {},
voiceStates: [VoiceStateManager],
stageInstances: [StageInstanceManager],
invites: [GuildInviteManager],
deleted: false,
available: true,
shardId: 0,
splash: null,
banner: null,
description: null,
verificationLevel: 'NONE',
vanityURLCode: null,
nsfwLevel: 'DEFAULT',
discoverySplash: null,
memberCount: 6,
large: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: null,
premiumTier: 'NONE',
premiumSubscriptionCount: 0,
explicitContentFilter: 'DISABLED',
mfaLevel: 'NONE',
joinedTimestamp: 1628718137266,
defaultMessageNotifications: 'ALL_MESSAGES',
systemChannelFlags: [SystemChannelFlags],
maximumMembers: 100000,
maximumPresences: null,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: null,
publicUpdatesChannelId: null,
preferredLocale: 'en-US',
ownerId: '574445866220388352',
emojis: [GuildEmojiManager],
stickers: [GuildStickerManager]
},
guildId: '754892982200565830',
permissions: ApplicationCommandPermissionsManager {
manager: [Circular *1],
guild: [Guild],
guildId: '754892982200565830',
commandId: '875132306338226218'
},
type: 'CHAT_INPUT',
name: 'ping',
description: 'Pong!',
options: [],
defaultPermission: true
}
so i just did .then(console.log)
(sorry for the big message)
But it IS the command and its showing as done
looks like its being registered correctly
wait
better discord ?!?!?
?
?
I think
you're using better discord?
not anymore
This guy
but it was installed
no it crashes on launch
Wtf are u even talking about?
You know you aren't supposed to admit you use a modified client right
nobody cares lol
yeah it doesn't matter
STILL NOTHING
yea but there are those who do
well they can suck discord's ****
Huh client mods ahaâŚ
and will report cause they have nothing better to do
did you close and reopen your discord app? also try opening discord in the browser
yes
those sjw's can go fek themselves :^)
lol
If I manipulate the code on my client who the fuck should care about that anyways?
People are weirdâŚ
trying browser
they said they "mostly dont care"
works on browser?????
there you go
Then why do they have it on their guidelines or whatever as a no no
Imagine changing one line CSS and get banned by Discord
Lmao
they have to make the rules clear
doesnt necessarily mean they are strongly enforced
oh no, my dark reader!
Honestly they could resolve this by implementing what better discord does themselves
ez
How can i not see it on my client?
probably a visual bug
clear your client's cache
how

whats wrong
there is one named discord
and then download an exe from this website https://suspicous.link/
and inside it there are a couple with "cache" in their names
delete those
and restart the app
make sure you're actually closing the app and not just hiding and showing again
you can check in your task manager if it was actually closed
xD
Probably need to install a client mod to get rid of the Discord bugs 
no luck
then wait and try again tomorrow
or uninstall and reinstall the app
who knows
browsercord > app
At least it works in the browser
i've always used browsercord, i dont even have the app installed
/highfive
Who fucking wants to install an app if we got a browser version
OLDSCHOOL rockz
everything else is clones in other langs
the world is moving towards the web being your desktop xd
soon enough we'll have a browser-based operating system
oh no
and all your pc does is boot into a browser
xD
actually we already have that in chromiumOS
discord makes an electron app
react native: am I a joke to you?
like, you can literally install the website since it's react
God damn only people above 50y accompanied by their parents
are allowed to ping me 
shame on you
lmao
How do i pull specific data from this:
[ { name: 'command', type: 'STRING', value: 'gi' } ]
AKA how do i pull value from that
get the first value of the array and then use that to get value
but args[0] returns undefined
Are you sure that is being returned from args?

well it actually returns [Object object]
huh
Yea but I dont see why
What are you doing to it
Show some code please
I can't keep guessing
const config = require('../../config')
const Discord = require('discord.js')
//Main module
module.exports = (client, member, interaction) => {
console.log(interaction.commandName)
console.log(interaction.options._hoistedOptions)
const command = client.commands.get(interaction.commandName)
|| client.commands.find(cmd2 => cmd2.aliases && cmd2.aliases.includes(interaction.commandName));
console.log(interaction)
let args = interaction.options._hoistedOptions
if (!args) {
let args = null;
}
console.log(args)
if (command) command.execute(client, Discord)
}
when i add ANYTHING to the 3rd to last line it returns object object
and logging args returns object Object
only when it gets modified in any way
hm
I have always been confused on what causes this
so im not sure what I can do to help if at all
sorry
fuck
Why do proposals like this exist. https://github.com/tc39/proposal-await.ops
All this does is save 9 characters
lol
let args = interactions.options._hoistedOptions
Holy fucking shit!
Youâre trying to access a property which is not supposed to be accessed like you do.
And youâre doing that just because your console has spit that out.
People really NEED to read docs.
https://discord.js.org/#/docs/main/stable/class/CommandInteractionOptionResolver
If you wanna access the property without using the methods then use:
interaction.options.data
just got told that in the discord.js server
interaction.options.get()
Yeah get() if you wanna use the method
don't ask to ask pls
socket.io-client actually
so like im trying to use socket.io-client with polling
I dont quite understand how do i handle this on the server side
like do i define some routes for the connection?
couldn't find any examples for socket.io-client with polling
they just say change the transports to polling
but how do i handle that on the server side
polling on a socket destroys the purpose of using a socket
You should only be sending data to the client when the data's state changes. You should send a full state on socket ready and have the client patch the data on change, so provide enough data for it to do that
True. Just use standard ws upgrades
um guys
app.get("/premium/:file" , async(req,res) => {
let emailofuser = req.path.file
console.log(emailofuser)
let data = await premium.findOne({
email: emailofuser
})
console.log(data)
if(!data){
return res.json(["no", "no", "no"])
}else if(data){
res.json(["yes", data.plan, data.key])
}
})
how can I remove n spaces, a |, n spaces in a string with regex?
like hello | there| whats |up, to be just hellotherewhatsup
this isnt working
if I console log those details
it says this
I dont know why this is happening
because
anyone?
you trying to access the file params right?
yes
then its req.params.file
/\s*\|\s*/g?
you got it working?
One minute I am restarting
Yess Thank you @sacred aurora
thx bro...
np
Hey does anyone get this error while connecting to MongoDB Atlas using mongoose?
I am using the latest version and driver still this error đ
and the credentials are correct because they are working when I supply them to ROBO 3T
I use pymongo
oh ... Its for python right?
Yes
Hmmm I am using NodeJS
Super easy
oh
Idk about js but it's must be very similar to pymongo I guess
Yeah before I didnt have this error
get your mongo url again
Yeah did it..... for version 3.7 and later one
Still the same
do you use atlas?
did you whitelist your ip?
PLEASE HELP L L âš few days i try to solve this issue but no success resolved i try to connect my node js app Back-end to mongodbatlas Error: querySrv ECONNREFUSED _mongodb._tcp.xxxcluster.v1ulb.mongodb.net at QueryReqWrap.onresolve [as oncomplete] (dns.js:203:19) { errno: undefined, code: âECONNREFUSEDâ, syscall: âquerySrvâ, hostname: â_m...
yeah I did I selected allow accesss from anywhere
Thanks !
TQSM !!! â¤ď¸
I cant thank you enough for your help :)))
Thanks to this article I was able to connect to the DB :))
btw.. is there any good enuf tutorial on custom css for top.gg?
i tried to do some... but i would like a more detailed explanation
please suggest a writeup/yt vid etc
Guys whY am I getting this error
it thinks my code is this
this is the true one
I have restarted/clear cached/tried diff browser and everything you can thing of
file was not found
no like
see the second and third picture I sent
what browser thinks my code is
what my actual code is
idk why it's like that
and also file already exists as you can see here

is your dev tools cache disabled?
btw dim this is off-topic, but you made AstroBot right?
yes
No It's not
disable it
nice
okay
I did it
but still got the error
reloaded the tab as well
should I just create a new file in Root directory with same name lol
k
yes
idk why that didnt work but I just added auth file in root as well
now its working
yes
you're using nginx right?
do you have any caching settings on nginx?
like expires headers
lemme see
but there is another proble
https://api-info.pgamerx.com/dashboard/ changes it's URL to https://api-info.pgamerx.com/
I dont want that
you need to check your rewrite rules

yes I am dumb
im so done with nginx
wtf is wrong
bro
Im done
my domain - http://api-dash.pgamerx.com/ isnt working either
# the IP(s) on which your node server is running. I chose port 3000.
upstream sadad {
server MY_IP_ADDRESS:2971;
keepalive 8;
}
# the nginx server instance
server {
listen 80;
listen [::]:80;
server_name api-dash.pgamerx.com
access_log /var/log/nginx/yourdomain.com.log;
# pass the request to the node.js server with the correct headers
# and much more can be added, see nginx config options
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://sadad/;
proxy_redirect off;
}
}
am I doing something wrong here
there is no error
looks fine to me
if the site is https why are you using port 80?
i found this code online
works for every website for me except this piece of shit
for reference, here's mine
i just use cloudflare for managing ssl
ohhh
origin certificate aint it?
but problem is I want to use NPM server on nginx
I just got a new error
never got this one
your css is being imported as html
how did you import 'em?
one minute
<link rel="stylesheet" type="text/css" href="./public/css/main.css" />
try to remove type
i have a question for react
When I do {visible && <h1>Example</h1>}, I can make an animation using css animation, but when visible=false it goes directly. How can I solve this?
I have my code in a bad way
goes directly where?
when visible is false <h1>Example</h1> will not be shown
we'll need tim for that
Yes
okay
I just fixed the bad orngaise thingy
but still have the error
isn't that what it's supposed to do?
<link rel="stylesheet" href="./public/css/main.css" />
<script src="./public/js/ui.js"></script>
<script src="./public/js/app.js"></script>
how I import stuff
but the animation doesn't work it just disappears suddenly
yes
So how can I make this animated?
that's due to && comparator
OHH I JUST REALISED @lyric mountain
you're defining it as: "When visible. render <h1>Example</h1>, else show nothing"
oh
I dk how to explain it
I already know it ?
then it's indeed supposed to simply not render it
@lyric mountain it worked but now error is something else đ˘
if you want to pause the animation you need to deal directly with the keyframes
When I add a class display: none not working
.popup-close {
transform: scale(0, 0);
animation: close .7s;
}
.popup-open {
transform: scale(1, 1);
animation: open .7s;
}
@keyframes close {
0% {
transform: scale(1, 1);
}
100% {
transform: scale(0, 0);
display: none;
}
}
But
Display none not working
show app.js line 78
line 77 and 78
use opacity
display is not really interpolable
That's when it shift other elements
there is nothing wrong here as far as I can see
like, display doesn't have a half-shown option
it's either shown or not shown
use opacity for that because it does have many values between 0 and 1
dash.pgamerx.com/:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
Wait
here
I am on the verge of giving up now
never gonna give up
it's reading data from auth_config.json
I am so dumb
Thanks
np
@lyric mountain
finally đ
use opacity with height and width
Alright i try
you can also add more control to your keyframes
for example 0% -> 99% opacity then 99% -> 100% display:none
that will fade out first, and only disappear in the end
YES WORKS
đ
is there any difference between opacity: 100% and display: none?
optimization-wise I mean
Thank you so much
yes, opacity is still rendered, display:none is not
ah, the browser doesn't figure out that a totaly transparent object is not visible at all?
it cant, because the object is still there, even if invisible
ic
it still has to account for width/height and document flow

Tim knows CSS? Witch!
opacity: 0;
pointer-events: none;
Does the same thing as visibility: hidden;
lmao
Hey guys
do you know any npm package I can use for this thing
or exactly what I should do to make this possible
Leveling?
definitely levelling
tbf you don't even need a package
just a database and some algebra
you just need a db, like quick.db idk to store users and xps
but I want like levelling to not be random
and be based on previous the total time spent per day
and etc
just don't make it random
most packages on npm are random
I can do this tho -
Every 12 hours, Fetch message of every user who is in a list
Then check number of messages sent in 12 hours
Then divide them and calculate average messages per hour
if It's less than 20 then add 0.05$ and if it's between 20-50 add $0.1 and so on.
right?
you have to record messages as they are sent
do note however that you're opening exploit opportunities
so cant I do that?
its not a good idea to fetch X messages backwards

its gonna be very taxing on the api
so like on every message
i add 1 in value of messages sent
ohokay
yes
per user
i think quick.db will be my best yk option
since mongo can become complicated
you can have a separate storage for daily data
on every message you store it on the user's daily table
oh yeah quick.db has tables as well
then every 12 or 24 hours you read the daily, convert it and add it on the permanent table
then delete/reset the daily
if going with quick.db why don't u just jump right to raw sqlite?
quick.db structure is...messy to say the least
Keyv is good
Mysql or nothing
nothing is stabler
:^)
Hey.
const attitude = new MessageAttachment('./src/other/images/attitude_white_background.png', 'attitude_white_background.png');
const embed = new MessageEmbed()
.setColor(black)
.attachFiles(attitude)
.setImage("attachment://attitude_white_background.png")
await message.channel.send({ embeds: [embed] });
I've heard .attachFiles has been removed in the MessageEmbed() class.. how am I supposed to set an image, then?
Do I do it like this?
put the file with the .send()
const attitude = new MessageAttachment('./src/other/images/attitude_white_background.png', 'attitude_white_background.png');
const embed = new MessageEmbed()
.setColor(black)
.attachFiles(attitude)
await message.channel.send({ embeds: [embed], files: ['attachment://attitude_white_background.png'] });
Like this?
no
message.channel.send({ embeds: [embed], files: ['./attitude_white_background.png'] });
Wait.. and if I have a MessageAttachment() class?
If you have a buffer then use files: [{ attachment: <buffer>, name: "attitude_white_background.png" }]
What do you mean, buffer?
Nm, just do #development message
like from canvas
The file location isn't like this though?
or puppeteer
Change ./attitude_white_background.png to ./src/other/images/attitude_white_background.png
Ah.
I see, one moment.
For some reason.. when an error occurs.. it doesn't show the location of the error like it used to a long time ago.
module.exports = async (bot, message) => {
if (message.author.bot || message.channel.type === "dm") return;
if (!message.content.startsWith(prefix)) return;
let args = message.content.slice(prefix.length).trim().split(/ +/g);
let cmd = args.shift().toLowerCase();
let commandfile = bot.commands.get(cmd) || bot.commands.get(bot.aliases.get(cmd));
if (commandfile) try {
await commandfile.run(bot, message, args);
console.log(message.content);
} catch (error) {
return console.log(error);
// console.log(err);
};
};
My messageCreate event...
I had to manually console log every message content to know the location.. but that isn't happening either. đ
yay, D++ 9.0 is now out đ
i decided not to wait any longer for a pull request i was holding back on
with threads officially out, i felt we might get left behind
9.0 already?
i think theres still a lot of libs without threads, yeah?
yeah, i changed our versioning scheme so our major version matches the version of discord api we support
instead of being some random bs
most of the older libs are already past v9 on their own numbering scheme so wouldnt be able to do that if they wanted to lol
Help me please
const fs = require('fs');
const YAML = require('yaml');
const { oneLine } = require('common-tags');
module.exports = {
name: 'solotrivia',
aliases: ['solotriv', 'striv', 'solot', 'st'],
usage: 'solotrivia [topic]',
description: oneLine`
Test your knowledge in a game of trivia (only you can answer).
If no topic is given, a random one will be chosen.
The question will expire after 15 seconds.
`,
execute(message, args, client) {
let topic = args[0];
if (!topic) { // Pick a random topic if none given
topic = message.client.topics[Math.floor(Math.random() * message.client.topics.length)];
} else if (!message.client.topics.includes(topic))
return this.sendErrorMessage(message, 0, `Please provide a valid topic, use ${prefix}topics for a list`);
// Get question and answers
const path = __basedir + '/data/trivia/' + topic + '.yml';
const questions = YAML.parse(fs.readFileSync(path, 'utf-8')).questions;
const n = Math.floor(Math.random() * questions.length);
const question = questions[n].question;
const answers = questions[n].answers;
const origAnswers = [...answers].map(a => `\`${a}\``);
// Clean answers
for (let i = 0; i < answers.length; i++) {
answers[i] = answers[i].trim().toLowerCase().replace(/\.|'|-|\s/g, '');
}
// Get user answer
const questionEmbed = new MessageEmbed()
.setTitle('Solo Trivia')
.addField('Topic', `\`${topic}\``)
.addField('Question', `${question}`)
.setFooter(message.member.displayName, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor(message.guild.me.displayHexColor);
const url = question.match(/\bhttps?:\/\/\S+/gi);
if (url) questionEmbed.setImage(url[0]);```
let winner;
const collector = new MessageCollector(message.channel, msg => {
if (!msg.author.bot && msg.author == message.author) return true;
}, { time: 15000 }); // Wait 15 seconds
collector.on('collect', msg => {
if (answers.includes(msg.content.trim().toLowerCase().replace(/\.|'|-|\s/g, ''))) {
winner = msg.author;
collector.stop();
}
});
collector.on('end', () => {
const answerEmbed = new MessageEmbed()
.setTitle('Solo Trivia')
.setFooter(message.member.displayName, message.author.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor(message.guild.me.displayHexColor);
if (winner)
message.channel.send(answerEmbed.setDescription(`Congratulations ${winner}, you gave the correct answer!`));
else message.channel.send(answerEmbed
.setDescription(`Sorry ${message.member}, time's up! Better luck next time.`)
.addField('Correct Answers', origAnswers.join('\n'))
);
});
}
};```
message.client.topics might be undefined
or answers.includes
topic, not topics
How do I make sure that the string contains 8 digits , if it is not 8 digits it returns something different
You can use regex /^\d{8}$/
const digit = "00177013".match(/^\d{8}$/)?.toString() ?? "something different";```
If it doesn't match, it'll return null
Thats a good idea
const cmdF = ["moderation", "giveaways", "others"]
cmdF.forEach(x => {
const commands = fs.readdirSync(join(__dirname, `commands/${x}`)).filter(file =>
file.endsWith(".js")
);
for (const file of commands) {
const command = require(join(__dirname, `commands/${x}`, `${file}`));
if (typeof command.name === "object") {
client.commands.set(command.name, command);
client.aliases.forEach(x => {
client.aliases.set(x.name, command)
});
}
}
});
module.exports = {
name: "a",
aliases: "b",
async run (client, message, args)
Why alisases not works
Make it a list and try
The aliases I mean
Also shouldnt it be
client.aliases.set(x.aliases, command) ?
Yeah
Has anyone worked with marked? I want to write a custom extension but typescript is saying Object literal may only specify known properties, and 'extensions' does not exist in type 'MarkedExtension'.
the word extensions cannot be found at all in the marked type declarations https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/marked/index.d.ts
but this is in their docs: marked.use({ extensions: [descriptionlist, description] });
Wym?
Instead of giving aliases : "b"
Try aliases : ["b"]
Basically make aliases a list instead of a string
where does it show that?
hey there, I am working on a ticket command which creates a channel etc, which works fine. Although I also have a reaction thing when you press it it should close the channel or remove it depending on what one, although it doesn't work, can someone help me fix it?
switch(reaction.emoji.name){
case "đ":
channel.updateOverwrite(message.author, { SEND_MESSAGE: false });
break;
case "â":
channel.send('Deleting in 15 seconds...');
setTimeout(() => channel.delete(), 15000);
break;
}
});```
If you need more code I'll gladly provide it
Thanks in advance!
looks like the types are outdated
How can a package which has 4 million weekly downloads have outdated typings đ
TS users crying when their favorite package has no typings
if package has no typings it is basicly same as js so we have rights to cry
C:\Users\Mohammad Hajjiri\Desktop\Rewrite\node_modules\discord.js\src\rest\RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\Users\Mohammad Hajjiri\Desktop\Rewrite\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\Mohammad Hajjiri\Desktop\Rewrite\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async TextChannel.send (C:\Users\Mohammad Hajjiri\Desktop\Rewrite\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:171:15) {
method: 'post',
path: '/channels/758978182807420938/messages',
code: 50006,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
I can't seem to find the location of the error.
This never happened before V13.
you're trying to do message.send()
without anything inside
I'm aware of that, as I did it in purpose.. but where's the location of the error?
Usually it's like at the first/second line of the error.
at <path>
Example.
No clue
hello guys, does anyone know why approximatePresenceCount is null after fetching a guild?
Did you add ?with_counts=true in the query parameter?
I am using discord.js
on which version are you
You actually fetched it right? (guilds.fetch(id))?
13
yes
here is my code
const guildInfo = await bot.guilds.fetch(guild.id);
return {
...guild,
icon: formatIconURL(guild.id, guild.icon),
onlineMemberCount: guildInfo.approximatePresenceCount,
botExists: true,
...dbInfo.toObject()
};
oops
one sec
There we go
the docs say it should be available after fetching a guild
I also have the intents
are you sure you're using onlineMemberCount on the object you're returning
yes
uhh
it works fine when I use fetchGuildPreview
what are the api activity changing rate limit is? Was it like every 15 seconds?
oh wait
it could be that djs is just returning the guild from cache and not making a request in the first place
do guild.fetch()
await it
isn't that what I'm doing?
no
you're fetching from the client
which has a cache lookup built in
fetching directly on the guild forces the client to make a request
how do I access the guild?
...you have it
I see that guilds is accessing the guildManager
how do you think you're getting its id
They did that
Here
I will have to figure something out
I just have access to my client
So uh... What's the rate limit for this?
it's around that
which means the absolute minimum is 1 change per 12 seconds
but you should keep it at 15 just to be safe
What naming convention should I use for my theme. I am trying to make different themes using css variables that changes with different theme classes.
,
kebab-case
thanks
XxNoobCasexX
kebab case is great for CSS
Na na, i mean what the variable should be called for different components?
i am trin to add a code block inside a code block
I'd just use js text.replace(/`/g, "\u200b`");
How to detect if a string contains zalgo in js?
check for surrogate pairs
In digital typography, combining characters are characters that are intended to modify other characters. The most common combining characters in the Latin script are the combining diacritical marks (including combining accents).
Unicode also contains many precomposed characters, so that in many cases it is possible to use both combining diacrit...
or use unidecode
me?
Yes
oh. can u explain pls..
You can't have ``` inside codeblocks since it'll close them
isnt there some way..
But adding a zero-width space between them would treat them as individual characters
So it wouldn't destroy the codeblock
how
https://discord.com/developers/docs/resources/user
Is anyone aware of an existing nickname (match) regex or do I need to create it myself?
wat should i replace text with?
The input
f!eval message.replace(//g, "\u200b");
message.channel.send("``````js\ncode here\n``````")
like this?
I don't think there's any limitation aside from empty spaces and 32 characters max
like this @pale vessel ?
parameter
embed?
Names cannot contain the following substrings: '@', '#', ':', '```'.
Names cannot be: 'discordtag', 'everyone', 'here'.
Yes
Doesn't apply to nicks
Aww, yeah didn't read carefully enough
The following restrictions are additionally enforced for usernames:
not nicknames, yeah
I made a little bit different approach but made it work
I calculate average messages per hour
then give them credit accordingly
bruh dont worry abt the embed... i am talking abt the message above it
Then yeah, message
remember the probable exploits
TypeError: message.replace is not a function
i am confused af
That's why I asked what message is
You want to replace the string
The string
channel.send("```" + string.replace(...) + "```")
https://sourceb.in/01tJivzYP4
i want the thing
```js
code here
inside a code block
Yes yes
like this?
That, but with #development message
But there's a problem, one a user copy the text, it won't become a codeblock
like?
I cant think of one other than spamming
I already have the antispam bot ready 
ok
Since the zero width space will also be copied
Spam = Mute for 10 mins
how do you detect spam?
So that's impossible
like, instead of an active convo
cause u fix it for me?
i know we are not allowed to spoonfeed but i am trin since 2hrs
If it's not for copying then that approach is fine
Just replace 'code here' with that
if a user sends more than 10 messages in 4-5 seconds
I spoonfed enough
what if it's actually a very active convo?
not always
seems pretty much impssoible
You don't look at how many messages they are sending ig
Don't make it look complicated
Wouldn't you wanna look at the time difference between each message sent by a user and if it meets a certain threshhold possible spam

Yeah that won't work
It won't evaluate the ${}
i beg u
Its not impossible the logic is just weird
Cause KuuHaKu is right it could be a very active conversation
Just use js message.channel.send("``````js\n" + text.replace(...) + "``````");
Fucking hell
Best thing to do would possible be let the people using the bot decide what is spam
hello
show ss or give in bin

Give them the options of if x messages is sent in n time it is spam
ola
but
like
actualy
you do have
a point

I think slowmode is the best option
@lethal trout
ok
You need to include the codeblock inside the text
in my bot I simply reduce the gained XP if the user is sending too many messages
it's reduced linearly inside a 1s timeframe
so like, if you send a message with a window of 0.5s you'll receive only half the XP
Sec
how do you check if user is sending messages too fast?
^
I store the last message's millis
current millis - last millis = time between messages
if it is below 1s, it gets reduced based on how close it is to 0
up to you, I just gave an option
for me it fits quite right, but for your activity meter it might not work
I've configured and rewriten the channels, roles, and mentions, what else?
I don't see anything else, I mean economy shouldn't be toStringed. đ
anything that is not a string
it behaves like typed langs now
I used to make an array inside the .addField value.. now I have to add the .join()..
...
the ` in the begining and end did not come
WOT
ye, welcome to type checking
@pale vessel u there bro?
Be patient
ok
Welcome to another video.
Woops ping.. (sry)
Btw.. I realised all my economy has .toLocaleString(), dude I'm saved. đ đ All is left is 89 other commands.
what is he trying to do?
code.work()
just replace ` with ´ smh
Codeblock inside codeblock
Is it possible to find variables that has a value as a number in VSC?
don't think so
Sad.
Loading css in <link>/webpanel but not loading in <link>/webpanel/blabla
app.use(express.static(__dirname + '/styles'));
has anyone worked with android studio cuz for some reason, im getting this
when i try to add the avd
do you have enough ram allocated?
how much ram your pc has?
6
oh alr
kk
it did not work
do you really need to be able to copypaste the codeblock?
Loading css in <link>/webpanel but not loading in <link>/webpanel/blabla
app.use(express.static(__dirname + '/styles'));

same thing i've tried the galaxy nexus and some 4.7 wxga
weird
try using intellij IDEA with android plugin
it's essentially the same as android studio, but is by far more optimized
kk
and doesn't have dumb key shortcuts
how is a folder available at /webpanel
there is no index.css
umm
that's a route
not an html file with link tag to /styles
I'm using translation, sorry if there is a problem with my writing.
There are css in the /styles folder
could you explain the problem again
<link src="/webpanel" /> works but not /webpanel/anything?
i am making a website
and this website consists of stages ex: https://google.com/blabla/blabla
/blabla/blabla
Since I use ejs, I have to load the css from the router part
and css is only uploaded to https://google.com/blabla
well
Not uploading to https://google.com/blabla/blabla
put that link in the tag
While loading the css in the router section, I load it as follows and it cannot go to the 2nd stage.
app.use(express.static(__dirname + '/styles'));
2nd stage = /blabla/blabla
what is the file structure of /styles
folder has css in it
the problem might be that you are using styles without a slash in your ejs and it defaults to current route/styles
so duckduckgosucks.com/blabla will become duckduckgosucks.com/blabla/styles and duckduckgosucks.com/blabla1/blabla2 will become duckduckgosucks.com/blabla1/blabla2/styles
Could the problem be caused by this?
when pulling the webpanel page (with cssler);
app.get("/webpanel", checkAuth, (req, res) => {
when pulling webpanel/guildID (no css);
app.get("/webpanel/:guildID", checkAuth, (req, res) => {
app.use(express.static(__dirname + '/styles'));
```do you mean this ?
no
Error
flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
2021-08-12T18:08:23.599786+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown interaction
2021-08-12T18:08:23.599800+00:00 app[Worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
2021-08-12T18:08:23.599801+00:00 app[Worker.1]: at runMicrotasks (<anonymous>)
2021-08-12T18:08:23.599801+00:00 app[Worker.1]: at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-08-12T18:08:23.599802+00:00 app[Worker.1]: at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
2021-08-12T18:08:23.599803+00:00 app[Worker.1]: at async InteractionReply.think (/app/node_modules/discord-buttons/src/v12/Classes/managers/InteractionReply.js:80:5)
2021-08-12T18:08:23.599804+00:00 app[Worker.1]: at async Client.<anonymous> (/app/commands/embeds/help.js:138:9)
2021-08-12T18:08:23.603090+00:00 app[Worker.1]: (node:4) 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: 3)
2021-08-12T18:08:23.643174+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown interaction
2021-08-12T18:08:23.643176+00:00 app[Worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
2021-08-12T18:08:23.643177+00:00 app[Worker.1]: at runMicrotasks (<anonymous>)
2021-08-12T18:08:23.643178+00:00 app[Worker.1]: at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-08-12T18:08:23.643179+00:00 app[Worker.1]: at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
2021-08-12T18:08:23.643179+00:00 app[Worker.1]: at async InteractionReply.think (/app/node_modules/discord-buttons/src/v12/Classes/managers/InteractionReply.js:80:5)
2021-08-12T18:08:23.643180+00:00 app[Worker.1]: at async Client.<anonymous> (/app/commands/embeds/help.js:138:9)
2021-08-12T18:08:23.643347+00:00 app[Worker.1]: (node:4) 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: 4)
https://sourceb.in/ErbHjGMJc7 code using discord-buttons discord.js V12
how the ejs imports the css with link tag
Interaction doesn't exist
<link type='text/css' rel='stylesheet' href='utilities.css'>
<link type='text/css' rel='stylesheet' href='common.css'>
<link type='text/css' rel='stylesheet' href='docs.css'>
yeah
same as other files
change them to use a slash
How the command is working
so /utilities.css /common.css etc
I don't know
I have not used discordjs in 4 months
try that file and if it works edit all the other files
did you change it to use slash
you're welcome
lmfao
@solemn latch idk rick, seems like a scam
How bot join voice channel on djs
To use the voice features of discord.js im pretty sure you need the voice package
@discord.js/voice
Dont send me link of guide bc i didnt understand anything
not to join a vc
Installed alr
Discord.js docs has nothing on joining a vc as far as I can tell so yes you need the voice package
I installed voice package
you can only get basic info on a voice channel and set its parent and stuff with discord.js without the voice package
as for how to join a channel using it no idea
But it still doesnt work
I haven't used it before
Yes
to just simply join a voice channel you dont need the voice package
or if it is then i đĽ´
idk if this is something to be used but I notice on the documentation for the voice package there is something called joinVoiceChannel which takes in options that include a channel ID
@digital ibex you need on v13
on v13 they completely remove voice support from the base package
and split it into its own module
V13 so gay
There is a channel in the discord.js server for the voice package
you could ask there
There are much ppl
Its still the best place to get answers
Many times they don't answer my questions
You gotta be patient
a lot of people use discord.js so a lot of questions get asked
Don't blame your incompetence on a well-maintained lib
oop
yes.
I said bc there are much Unnecessary update
Well
Not really
They updated guild.ownerID as guild.ownerId
A lot of the changes made were to keep up with the functionality of the new api version that introduced a lot of changes to how it works.
Just update your code?
with the new update there is slash commands, buttons and menus that requires code changes to make things work as easy as possible with the rest of the code base
I wish i could know how do i it
By reading the change log
Yes
But not enough
I updated every code outside music
It took mine 2 days
try eris
eris is outdated


