#development
1 messages ยท Page 1882 of 1
@_@
Ah yes. That's a Java/javascript.
sometimes just asking the question helps
You can set slash commands with this:
await client.guilds.cache.get(guildId)?.commands.set(data)
But how can you delete slash commands?
Use user_id ig
Look on stack overflow
Can we log the dms of our bot?
so i have made a pause command which pauses the audio stream.
using connection.pause()
then i wanted to make it resume using connection.resume()
but it doesn't resume
are there any alternative methods to..resume a paused stream?
Yeah, I just wanna check it out... Not going to add tho
@quartz kindle for robin hood maps looking up non-existant keys is coming to bite me back
right now i'm iterating over the whole list to find out if a key doesnt exist since that key couldve simply been moved
thats 100% not how to do it i believe
(im back to here because i accidentally left in an infinite loop in the checking mechanism not giving up after iterating over the whole map)
hi
When the bot tries to delete 2 times one message he throws an error: Unknown message. So I tried to catch this error but none of these works:
MsgCollector.on('collect', async collected => {
try { if (collected) collected.delete() } catch { }
})
Anyone knows how I can catch this?
let string = "This is a sentence that has a lot of space and wants each word seperated into its each index in an array."
How can I seperate each word?
.split()
thanks
string.split(" ");
appreciate it
string.split(/\s+/)
message.guild.channels.create(`${message.member.user.tag}-ticket`, {
type: "text",
permissionOverwrites: [{
id: message.guild.roles.everyone,
deny: ['VIEW_CHANNEL']
},
{
id: message.author.id,
allow: ['VIEW_CHANNEL']
}],
})```
yw
perhaps keep track of the highest probe rate and break when it reaches this?
yes but a restart will ruin your dreams unless you re-await after a restart
and thats also a memory leak
you have to check the increment thingy
The probing terminates when an empty slot is found, or a key is encountered which has a PSL higher than the sought key would have in that slot. (If the sought key had been in the table, it would have been located before that key.)
oh that's because I don't move my keys back when removing which changed my way of thinking
will add that which will let me use that logic thanks
the channel is returned to you
just save it in a variable
show your code
create is a promise
await it
show more of your code
execute is async, the callback in .then() is sync
if you want to clean it up
const collected = await awaitReactions;
if(collected.first().....)
//the rest of the code
?
yes
yeah, i just did it so i don't have to type it all out
i'm lazy
it was just an example on how to clean up your code to be properly async
oh my
actual fucking god
^
it was not meant for you to copypaste
^
????????????????????
yes
it was just an example
SO WHY ARE YOU
OH MY
literally just add message. in front of awaitReactions and add () to make it a method call

you have been trolled successfully
Yup
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\Mohammad Hajjiri\Desktop\Node.js Projects\Simple\Vocabulary\node_modules\ora\index.js from C:\Users\Mohammad Hajjiri\Desktop\Node.js Projects\Simple\Vocabulary\src\index.js not supported.
Instead change the require of C:\Users\Mohammad Hajjiri\Desktop\Node.js Projects\Simple\Vocabulary\node_modules\ora\index.js in C:\Users\Mohammad Hajjiri\Desktop\Node.js Projects\Simple\Vocabulary\src\index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\Mohammad Hajjiri\Desktop\Node.js Projects\Simple\Vocabulary\src\index.js:9:13) {
code: 'ERR_REQUIRE_ESM'
}
What does this mean?
https://www.npmjs.com/package/ora
const Ora = import("ora");
const waitASecond = async () => new Promise((resolve) => setTimeout(resolve, 1000));
const spinner = Ora('Fetching the input.');
spinner.start();
await waitASecond();
spinner.color = 'magenta';
spinner.text = 'Boarding Passengers';
await waitASecond();
spinner.color = 'yellow';
spinner.text = 'Starting Engines';
await waitASecond();
spinner.color = 'Green';
spinner.text = 'Launching the rockets.';
await waitASecond();
spinner.succeed('Houston? We landed!!');
Apparently it's erroring:
const spinner = Ora('Fetching the input.');
^
TypeError: Ora is not a function
import() returns a promise
Ora is not a function, though. ๐
yeah it's a promise
yeah, it's a promise
More explanation?
log Ora
[Module: null prototype] {
default: [Function: ora],
oraPromise: [AsyncFunction: oraPromise]
}
Hi im new to discord.js and I want to make a youtube post notification is there a tutorial for this?
Bad typescript project
Use Ora.default()
Solved.
const Discord = require('discord.js');
const db = require('quick.db')
module.exports = (oldState, newState) => {
if (!newState.channelID) {
mainInterval = setInverval(function() { db.add(`coins_${newState.id}`, 30) }, 30000);
} else if (!oldState.channelID) {
clearInterval(mainInterval);
}
};
mainInterval is not defined at the clearInterval :/
setInterval
replace setInverval with setInterval
typeerror
the mainInterval isn't in the same branch
euhh
can I stop intervals with clearInterval();?
wait
yes
but all intervals in the bot?
clearInterval restarts i think
no
oh :/
only the (mainInterval) u specified
and if I don't specify a name
clears all
yes so I can clear all?
i think i'm not sure
oh I can, its this, thx x)
const db = require('quick.db')
module.exports = (oldState, newState) => {
let mainInterval;
if (!newState.channelID) {
mainInterval = setInterval(function() { db.add(`coins_${newState.id}`, 30) }, 30000);
} else if (!oldState.channelID) {
clearInterval(mainInterval);
}
};
I test
ok
if i make an changing status in my bot whats the minimun seconds interval to not get rate limited?
5 seconds i think
oh k ty
i did 15 bc 5 little too fast lol
i will suggest to change it every 10-15 sec doe
ye
yea
Does anyone know why I am getting this error? commands is not iterable
my bot just hit 75 servers :D
luki lol
took some months
nice
i cant get mine past 23 servers ;-;
oh
lul moment
mine wouldt get past 50 or something
const Discord = require('discord.js');
const db = require('quick.db')
module.exports = (oldState, newState) => {
let mainInterval;
if (!newState.channelID) {
console.log(`yes`)
mainInterval = setInterval(function() { db.add(`coins_${newState.id}`, 30) }, 30000);
} else if (!oldState.channelID) {
console.log(`no`)
clearInterval(mainInterval);
}
};
when I join a channel, the interval starts and I have 'yes' in the console but if I leave, the bot says 'no' but the intervals dosen't stop :/
const db = require('quick.db')
module.exports = (oldState, newState) => {
let mainInterval;
if (!newState.channelID) {
console.log(`yes`)
mainInterval = setTimeout(function() { db.add(`coins_${newState.id}`, 30) }, 30000);
} else if (!oldState.channelID) {
console.log(`no`)
}
};```
try this
Why should they try that?
yes but I want if a member is in a channel, every 30 seconds, he get 30 coins :/
How can i zoom out on canvas
Usually you state your issue when asking for help
took the words out of my mouth
Damn, ๐ค๐ก here have it back
const Discord = require('discord.js');
const db = require('quick.db')
module.exports = (oldState, newState) => {
let mainInterval;
if (!newState.channelID) {
console.log(`yes`)
mainInterval = setInterval(function() { db.add(`coins_${newState.id}`, 30) }, 30000);
} else if (!oldState.channelID) {
console.log(`no`)
clearInterval(mainInterval);
}
};
when I join a channel, the interval starts and I have 'yes' in the console but if I leave, the bot says 'no' but the intervals dosen't stop :/
when i run another bot it is working fine
and when sharding starts and some one uses slash play command bot is giving error unkown interaction

Lib version?
Also, show ur current code
in discord.js, how can i attach a Stream or a Buffer to MessagePayload.files[]?
could use MessageAttachment
Yes
or in any interaction?
and would i just insert a MessageAttachment like i would with TextChannel#send?
like "content", MessageAttachment?
I think js send({ content: "content", files: [attachment] })
Can I dm you
mmk, i tried this and it didn't turn out so well - i might just resort to normal DMChannel#send for the image itself since it's a captcha anyways
Did you get an error
nah it just didn't attach the file
You can't attach images to interaction responses it's an API limitation https://github.com/discord/discord-api-docs/discussions/3581
ah okay
thank you mac
could I attach a Stream or Buffer to a message embed then, perhaps?
No problem!
I'm waiting for it to be able to do my djs v13 rewrite.
You should be able to do that yeah
You can put that in an embed but not as an attachment
oh - just interested, why do you need message attachments specifically? are you uploading actual files in interactions that aren't images?
I need it to upload canvas buffers as message attachments
const Discord = require('discord.js');
const db = require('quick.db')
module.exports = (oldState, newState) => {
let mainInterval;
if (!newState.channelID) {
console.log(`yes`)
mainInterval = setInterval(function() { db.add(`coins_${newState.id}`, 30) }, 30000);
} else if (!oldState.channelID) {
console.log(`no`)
clearInterval(mainInterval);
}
};
when I join a channel, the interval starts and I have 'yes' in the console but if I leave, the bot says 'no' but the intervals dosen't stop :/
Kind of how those welcome or rank canvases work.
What's stopping you from deferring and editing the original response ๐ฉ
Canvas might even take over 3s to process anyways
So you might probably need to end up deferring
That's slow and hacky. I just need the interaction option.
And my canvases are optimised enough to not take 3s ๐
even if you need to make a ton of them at once?
I have a command that involves posting dozens and dozens of canvases in a channel at 15s intervals.
someone pls?
Ahh I see
I would personally put it on a temporary CDN but to each their own, it makes sense anyways
I pre-render canvas parts, store them in memory and use those instead of re-rendering an entire canvas each time.
Ahh I see
Any budy plz help
Sounds like API abuse ๐
Lol 15s isn't API abuse
Yeah I know but I meant the dozens of canvases
It's a hunger games simulator
Ah that makes sense
There's not much of a choice 
someone?
console.log mainInterval inside the no side.
Why declare mainInterval inside the function
^
Declare it outside or you'll never able to access it ever again
followups or button interaction replies
also in djs, why am i not receiving DIRECT_MESSAGES events? i have the intent enabled
Yeah but people usually chat during the games so the messages would get lost in chat
oh fairs
Hey I created a welcome command on discord.py but I want to make the bot responsd the user welcome when the bot has a role (welcome) how can I code this any help? Python
yes but how to set the interval after?
undefined ๐ฆ
Just move let mainInterval outside
yes but the interval will be activated
How do i check if my bot has kick_member or administrator permissions?
djs?
if "discord staff" in name.lower():
if member.guild.me.kick_members or member.guild.me.adminstrator:
await member.send(embed=embed)
#await log.send(embed=embed)
await member.kick(reason="Users name was associated with a potential scam.")
return```
i know that didin't work
that's a VERY specific scam detection
this is a loop which goes off every 5 mins
it checks if any user is called discord staff
and its the same for hypesquad events too
that's why I said very specific
sopy if "discord staff" in name.lower(): if commands.bot_has_guild_permissions(kick_members) or commands.bot_has_guild_permissions(adminstrator): await member.send(embed=embed) #await log.send(embed=embed) await member.kick(reason="Users name was associated with a potential scam.") return
im not sure if that works lmao
I dont know py ๐
but I assume so
python devs love long descriptive names doesn't 'em?
youll need to submit a request for verification at that point
anything i should take care of while verification?
ohh okk
ohkk
the discord developers server can help more than we can.
https://discord.gg/discord-developers
thanks
also cute cat in pfp lol
nala โค๏ธ
for more
weirdly, as soon as they are sent in discord they work.
ah, width failed? ๐
without width it does taht
i might make a subdomain of my family domain for my dog
not cat
hey was wondering if someone might be able to help me with an error I've been having trying to connect my bot to a voice channel? I have a feeling this has probably been said a lot xD I keep getting this error:
even tho I already have it installed
How can I get bot server count on to my website? Topgg does this with every bot so it doesn't have to be a bot -> db -> website connection right?
you need to install discord.py voice
i guess u are using discord.py
pip install discord.py[voice] i believe
oh you know what, i bet my vps is out of storage, it tries caching it and fails
pip install discord.py[voice]
python3.9 -m pip install discord.py[voice]
I also installed that
How can I get bot server count on to my website? Topgg does this with every bot so I think you only need bot token and maybe discord api fetch??
nope, not out of storage. strange
i was switched over to a new webserver the other day (free upgrade ๐ and its so much faster) but im not used to the new url
you can use jquery
lemme go get the code i used
they legit use drink names
hmm, I enabled UFW recently, maybe I'm accidentally blocking something
kek yeah, firewall was blocking a port I needed public.
thank you
info.updateOverwrite([
{
id: '887988412508938270',
allow: [],
deny: ['VIEW_CHANNEL', "SEND_MESSAGES"]
},
{
id: message.author.id,
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'ATTACH_FILES', 'EMBED_LINKS', 'READ_MESSAGE_HISTORY'],
deny: []
},
])```
(node:1554) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.
the id is a role id, idk why its not working
you inputed a string not an int i believe
huh?
i literally have this in another file but its channel.createOverwrite or smth
and it works fine
you need to include a type to the overwrite since it can either be an overwrite for a user or a role
could it be because
info is defined as
let info = message.mentions.channels.first()```
If your client has permission to alter the channel mentioned, it'd work regardless
Ok. So read your lib's docs and see what you have to pass into the array objects
most likely a type field
there's no type in updateOverwrite
Then it wouldn't be complaining about types if there wasn't
<strong id="servers">0</strong>
<script>
$.getJSON('APIURL', function(data) {
document.getElementById("servers").innerHTML = `${data.server_count}`;
});
</script>```
replace server_count with whatever the API output you want to show
Then it probably checks for you. That means that first ID you passed doesn't belong to a role of that guild or isn't a user you have cached
what api url?
the role provided is a valid role.
i have a diff cmd and i have this;
channel.overwritePermissions([
{
id: `${message.guild.id}`,
allow: [],
deny: ['VIEW_CHANNEL']
},
{
id: message.author.id,
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'ATTACH_FILES', 'EMBED_LINKS', 'READ_MESSAGE_HISTORY'],
deny: []
},
{
id: '887988412508938270',
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'ATTACH_FILES', 'EMBED_LINKS', 'READ_MESSAGE_HISTORY'],
deny: []
},
])```
works perfectly fine
but when it comes to updateOverwrite its not working
and idk why
well nvm then
this works
the thing above doesnt
weird but oh well
even if the bot isn't on topgg??
oh then you should do something like flask if using discord.py
i made a simple api that gets the bots server count
then gets the server_count json output and displays on the site
can't I just fetch guild count with the bot token or botid? f.e. topgg also doesn't have an api for every bot xD I mean for the guild count
true true
how have they done it?
bots post their server count to topgg
btw - what should i use to make a gallery for dog pic lmao
front end
but how? Does topgg send them a request? because no bot dev does implement something for topgg
no, bot devs send us the data. we dont send anything
but the guild count updates automatically.
how can i check if message.mentions.channels.first() starts with a certain name (e.g: ticket-)
the token and prefix etc. yes the bot dev does provide this but guild count updates automatically
the nice little animation for nala.pics uses masonry.
its really easy and convenient for making grid layouts.
https://i.woo.pics/c309c4c098.mp4
they update automatically, because bot devs send the requests automatically.
just doing https://docs.top.gg/api/bot/#post-stats on a loop
using startsWith
does https://top.gg/api/bots/:bot_id/stats work even if I don't have the bot on topgg?
no
How can I fetch the bots guild count without having it on topgg?
your bots guild count?
yes
what library?
discord.js
sharding or no sharding?
no sharding
client.guilds.cache.size
yes but now I want to be able to access it from my website
i gave up and chose wordpress
i'll send the link when its done
Someone know how to run async code with isolated-vm?
why does dynamodb think this is a good idea? adding types as a field
hello how to center the title in a web page (HTML)
margin: 0 auto
me ?
yes
can you show me an example plase
h1 {
margin: 0 auto;
}
oh okey thx
hi so i tried to pause a
let controller = connection.play(stream, { seek: 0, volume: 1 })
.on('finish', () => {
//something
});
by doing
controller.pause();
which paused well, but
controller.resume();
does nothing. am i missing something here?
also please ping me, i may miss it
can someone help me make a / command handler with djs?
The djs guide covers that
it dose??
anyone know how to make bulk calls to dynamodb using the v3 library
the first test is able to get the record.
id is the primary key
i needed to use single quotes here.
use statements
also, u dont need to quote column names
unless it has uppercase chars
like guildName
they call this partiql
Aliasing is not supported
wonderful
doesn't look like counting is supported
dynamodb is very frustrating to deal with I gave up on it a long time ago
never give up
manz just got banned the second i opened this channel
amazon claims that count is supported
https://docs.aws.amazon.com/qldb/latest/developerguide/ql-functions.count.html
it knows count is a keyword
Hello, does anyone have a good fun fact api?
fun fact: I've never heard of one
ah ok
just find some random subreddits correlated to that and fetch a random post from reddit
or use something like https://apilist.fun/api/random-facts-api
it's not that hard to google
for discordjs
to get a member from cache (i have the intent)
it's .members.cache.get() right?
i think cache is just a normal array
and those dont have get
id use this method
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
Itโs a collection not an array and get() is the right function, yes.
Keep in mind not all members are cached at any time.
Using fetch() instead of get() is the way to go.
fetch() caused a ton of problems to me like getting rate limited (and bot crashes- which ik how to fix but lazy)
How can you check with code if a channel is required (Community Servers) (JavaScript).
Fetching a single user doesnโt cause a rate limit.
You must be doing something wrong in terms of spamming the API.
Huh what? A channel required for what?
Because for the moderator channel, and the rules channel are required for Community Servers, and so my bot is unable to delete the channel for one of my commands so it crashes the bot...
Just add a try catch
It crashes your application because you donโt handle its errors.
You should take a look into a proper error handling code example.
Any unhandled error will kill the process (in the future).
looking at the discord docs, community channels have zero public flags for telling if its rules, guidelines or updates channel from a bot.
actually, its part of the guild object for rules.
https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
not sure your library, but the property is listed on the djs docs.
https://discord.js.org/#/docs/main/stable/general/welcome
How would I add a value to a 2d array?
Ex.
let test = [];
test.push(memberID);
let userElo = rows[0].elo;
// Add userElo to the memberID so its:
/*
memberID | userElo
someID | someElo
*/
let test = [];
test.push([memberID]);
let userElo = rows[0].elo;
test[0].push(userElo);
test; // [[memberID, userElo]]```
Thanks!
What about a 3d array (or multidimensional array)?
let test = [];
test.push(memberID);
let userElo = rows[0].elo;
let skips = 0;
// Add userElo to the memberID so its:
/*
memberID | userElo | skips
someID | someElo | skips
*/
Would it be the same thing?
Error:
E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\util\Util.js:414
if (!allowEmpty && data.length === 0) throw new error(errorMessage);
^
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.
at Function.verifyString (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\util\Util.js:414:49)
at Function.normalizeField (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\structures\MessageEmbed.js:443:19)
at E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\structures\MessageEmbed.js:464:14
at Array.map (<anonymous>)
at Function.normalizeFields (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\structures\MessageEmbed.js:463:8)
at MessageEmbed.addFields (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\structures\MessageEmbed.js:286:42)
at Object.execute (E:\C) Developing\Wolfy Djs-13\commands\bot\cmd.js:40:12)
at Client.<anonymous> (E:\C) Developing\Wolfy Djs-13\index.js:295:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}
Fields
.addFields(
{ name: 'Usage', value: `\`${prefix}${cmd.name} ${cmd.usage}\``, inline: true },
{ name: 'ALIASES', value: text.joinArray(cmd.aliases) || 'None', inline: true },
{ name: 'COOLDOWN', value: `\`${cmd.cooldown}\``, inline: true },
{ name: 'Permissions', value: `${text.joinArray(cmd.permissions.map(x => x.split('_')
.map(a => a.charAt(0) + a.slice(1).toLowerCase()).join(' '))) || 'None'}`, inline: true },
{ name: 'Examples', value: `${cmd.examples.map(x=>`${prefix}${cmd.name} \`${x}\n\``)||'None'}`}
)
That happened when there is no permissions: ["perms"], or any other thing
in the handler model
Same thing, you just need to know the index of the parent array
Alright. Thanks!
since you already know why its happening, and reading at your error. Just check if there are actually any content, and if it is add it or else add something like "none" or "not set"
I did everything no thing is working
Just check if the array length is >= 1 before proceeding to map it, if its false then add a predefined string
ok
A 3d array? Why tho?
I've never seen a use-case for one
I need to have an array that contains 3 values.
user id, elo, and the amount of skips they have
That'd be 2d then
(now im having an issue with figuring out how to sort a 3d array by the second value lol)
wdym
Each index would have an array
im doing a match making system
So an array of arrays
3d would be an array of arrays of arrays
Database
If u use sql, a simple ORDER BY will do it
For nosql idk
i use mysql
wont it be better for it to just be a 3d array?
since i only need the data temporarily
heres my code:
https://sourceb.in/7CKM0rbkYW
I'm so sorry for you 
:(
2d
3d is an array with 3 levels
mb
If you'll be retrieving data anyway, you can just retrieve it ordered
using a db?
Ye
hmm
For mysql, ORDER BY table.mmr DESC
aight
table being ur table's name
okay so in discord.js i'm attempting to fetch a user's voice channel status; however, it's not returning the voice state. i have the voice states intent specified. is there a partial that i need to have or something?
Do u have guild_presences enabled?
is that it-
Ye
pain
Everything related to user status goes into that intent
well at least i have a valid reason for the intent in whitelisting now
Well, until u remember < 100 server bots can use that intent freely
ye p i know
im specifying GUILD_PRESENCES now and it still isn't returning that i'm in a channel
it has admin perms so it can see the channel and all too
Could be caching issue
THANK YOU FOR THE IDEA i think it might be discord.js-light
Eh
@hybrid cargo
let cmdpermissions;
if(cmd.permissions >= 1 || cmd.permissions === null || cmd.permissions !== String) {
let cmdpermissions = 'None';
} else {
let cmdpermissions = text.joinArray(cmd.permissions.map(x => x.split('_')
.map(a => a.charAt(0) + a.slice(1).toLowerCase()).join(' '))) || 'None'
}
let cmdexamples;
if(cmd.examples >= 1 || cmd.examples === null || cmd.examples !== String) {
let cmdexamples = 'None';
} else {
let cmdexamples = cmd.examples.map(x=>`${prefix}${cmd.name} \`${x}\n\``) || 'None'
}
E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\util\Util.js:413
if (typeof data !== 'string') throw new error(errorMessage);
^
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.
at Function.verifyString (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\util\Util.js:413:41)
at Function.normalizeField (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\structures\MessageEmbed.js:443:19)
at E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\structures\MessageEmbed.js:464:14
at Array.map (<anonymous>)
at Function.normalizeFields (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\structures\MessageEmbed.js:463:8)
at MessageEmbed.addFields (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\structures\MessageEmbed.js:286:42)
at Object.execute (E:\C) Developing\Wolfy Djs-13\commands\bot\cmd.js:54:12)
at Client.<anonymous> (E:\C) Developing\Wolfy Djs-13\index.js:295:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}
Anyone know how to fix that >?
oh my god
what's wrong?
my brain stopped functioning a while ago
cmd.permissions !== String
will always return true
same for cmd.examples !== String
this man needs to know the power of ternary operator
@slow terrace #development message
your code also isn't related to your error
Your error is trying to pass something like a number or an Array or whatever into an embed name or field or whatever when it needs to be a string and only a string.
How
Because there is no embed code there
|| 'None' But why not working
const embed = new Discord.MessageEmbed()
.setAuthor(message.author.username, message.author.displayAvatarURL({dynamic: true}))
.setColor('738ADB')
.setTitle(`${prefix}${cmd.name}`)
.setDescription(`\`\`\`${cmd.description}\`\`\`\n`)
.addFields(
{ name: 'Usage', value: `\`${prefix}${cmd.name} ${cmd.usage || 'None'}\``, inline: true },
{ name: 'ALIASES', value: text.joinArray(cmd.aliases) || 'None', inline: true },
{ name: 'COOLDOWN', value: `\`${cmd.cooldown}\``, inline: true },
{ name: 'Permissions', value: cmdpermissions, inline: true },
{ name: 'Examples', value: cmdexamples }
)
message.channel.send({ embeds: [embed] })
That's great and all, but the first block of code you shared is flawed
use the typeof operator to get the type of something.
typeof "poggers" === "string"
typeof false === "boolean"
if (typeof something !== "string") console.log("something isn't a string");
String is a ConstructorFunction
can anyone teach me how to track down a system hacker?

๐คฆโโ๏ธ
how do i make bot music join stage?
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
what error is that?
anyone
ah wait
there is one imposter among your bits
H
error while pushing
don't push your node_module folder
guys
my bot is not replying
๐ญ
client.once('ready', () => {
console.log('Successfully logged into the bot.')
});
client.on('interactionCreate', async interaction => {
if(!interaction.isCommand) return;
const { commandName } = interaction;
if(commandName === 'ping'){
await interaction.channel.send('Pong.')
}
});
const discord = require('discord.js');
const fs = require('fs');
const botintents = new discord.Intents()
botintents.add(discord.Intents.FLAGS.GUILD_MEMBERS);
botintents.add(discord.Intents.FLAGS.GUILD_PRESENCES);
const client = new discord.Client({ intents: botintents });
const { prefix, token, bot_updates_channel } = require('./config.json');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const rest = new REST({version: '9'}).setToken(token);
here is my code
Hey Guys Can we use replit database with Node JS also? Or it is only valid for python?
@lost berry
??
what does this mean? TypeError: players is not iterable
you can't use for...of or for...in on players
what could i use for it then?
i wanna push their data to an array
const players = require('../../players.json').players;
let keepers = new Array();
for (const player of players) {
if(player.keeper === true) {
Array.push(`**${player.name}**\nPower: ${player.power}\n\n`);
}
}```
Hello how can I make a mobile version for my site (if possible also for tablet please)
Well first off, what is players? It's obviously not an array
Use flexbox and your website will be responsive on all screen sizes
its alr fixed, thanks
used for player in players
.gitignore the node_modules folder lol
Error: Cannot find module '../../config.json'
Require stack:
- /home/runner/music-bot/src/modules/laffeyUtils.js
- /home/runner/music-bot/src/Laffey.js
- /home/runner/music-bot/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/music-bot/src/modules/laffeyUtils.js:1:16)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/runner/music-bot/src/modules/laffeyUtils.js',
'/home/runner/music-bot/src/Laffey.js',
'/home/runner/music-bot/index.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! laffey@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the laffey@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-09-20T09_57_45_881Z-debug.log
exit status 1
๎บง
what this error?
Then you haven't put node_modules in that .gitignore
home/runner/music-bot/src/events/message.js:24
if (client.prefixes.get(message.guild.id)?.prefix) {
Ha! Was wondering where this douche isโฆ finally he got banned.
Big thanks to marco_rennmaus. ๐
A ) is missing
means?
ok
Whats the error?
dm
Measure the pings and check if that's an issue or your code might be the issue.
it was running well yesterday......
Well it's impossible to tell you where the problem coming from.
That's why I said just measure the pings to Discord and if these are okay, measure times in your script, like how long it takes from receiving an event until the response happens.
it is taking hell long
to measure it, I'm using guild map in console
and it is taking long ๐ฅฒ
member.guild.defaultChannel.send(`Welcome to the server, ${member}!`);
console.log(`${member.user.username} has joined`);
});```
why doesnt this work
do you have the intents enabled both in the dev portal and your code
lemme go look
FUCKKKKKK
it verified
how do i apply to get it
yea i just asked in there
@earnest phoenix what one do i need to tick
for it to work
server member
You will need another verification to get the intent.
server member
alr
You send a ticket and wait for 8 months to get approved. You should include a proof of concept of what you're trying to do and why you need the intent. Otherwise you'll be declined.
I'm not sure about the 8 months but that's how long I had to wait anyway.
Yep just make a test bot with the intent to be able to include screenshots etc of what they do.
alr bet
what one do i reqeust Guild_Members or Guild_Presences
Guild members
throw new RangeError('BITFIELD_INVALID', bit);
help with this err?
idk why i still get it
Anyone have any clever tips when making command files that work for messages and slash commands?
I'm doing fine it's just I feel like there might be a better way to transition. This is a lot of work ๐
language?
js
i'm assuming discord.js?
Yep
i'm using command handlers currently, i recommend it
although it's much more difficult for understanding
I've pretty much gutted the whole core of the bot and started over. I'm using command and message handlers then running the same command file just passing message / interaction to the command file.
Couldnt you just place each command in both its form(content/slash) in one each file.
then exporting each as its own export?
And I've started using an event handler because things were getting messy
i think it uses that mainly
I guess I could but those would be some long files in some cases ๐
At the moment I'm making them run off the same function
ah, then separating them entirely probably makes the most sense.
I basically wanted them running off the same code so it's easier to maintain and the UX is the same
But idk
That has its limitations
how to hosting bot 24/7 for free
google m1's are a good choice for free tbh.
I've managed to do it for a few commands already but I have a feeling some of the more complex ones might be a bit of a nightmare
nooooooooooooooo
if you properly microservice your commands, I dont think it would be too bad.
Would take some time to plan that out though.
oh my god. should i apply for github student developer plans for free hostung ???
a vps is like $3
๐ค since when does github student give free hosting.
Azure
ohh
i only have 1$ in my paypal and 0.5$ in my wallet

um... repl.it give it, but replit ask for github student pack
Yeah I guess I'm just being lazy and hoping for an easier option
I've been procrastinating the djs v13 rewrite for a while now.
My code is going to look nothing like it did before... Pretty much everything is being overhauled.
i do not reccomend repl because they set discord bot codes as public since it's shared. unless you wanna like by the pro plan which costs more
April 2022 right?
Yes
im sure every api version dies when april 2022 is here
except v9
But Idk if v6 is a different date
wait they're getting rid of discord bots api for js?
we are talking about the slash command requirement, not js.
The API v12 runs on will stop working
ohhhh
^
djs v13 runs on v9
the github student pack gives us hacker replit plans. so we can set it privately.
sharing code publicly also isnt a bad thing.
Man I have so much to do I need to stop procrastinating 
id say over 90% of devs here have their most/all of their code publicly listed somewhere
guys can someone explain this error to me cause my bot is about to reach 75 servers and i am looking through the verification system of discord and lets just say i have been lazy before and just took all the intents but now i need to check what intents are actually required by my bot
I don't open source anything I don't want ripped off by someone else
that means users can see your bot's token
since when?
env is depricated
???
env is os level
it cant be depricated
try to do .env
hey is there an intents calculator?
llike i got the number
but what intents does that number have
idk shit about intents
"you can create environment variables via the sidebar! (env files are deprecated)"
ye
i wont share my code for anyone who doesnt in my developer teams
kk
confusion
https://i.woo.pics/9aa3f5c4cd.webp
huh, i thought i couldn't use it anymore
and can i ask you a question?
how long do i need to get a bot approed to top.gg
@sinful night
The average up-to-date approval times are stated [here](#support message).
This does not mean it will take the same amount of time someone else's bot took to be reviewed and does not mean your bot is guaranteed to be reviewed within that time frame.
There is no exact time for how long bot approval will take.
There is a queue and you're not first, nor are you last.
Read more about our reviewal process here.
you can create environment variables via the sidebar!
that badge is no longer given by discord
oh im so sad ๐ฆ so my bot is no longer being verified?
bots can be verified, just you(verified bot developer) cant
ok ๐ญ so my friend wont believe that i am a verified mod developer ๐ญ
and... how can i find a server by server id?
via code? djs?
via server id
and how to be bot reviewers
nice
That's what I thought, too
throw new TypeError('CLIENT_MISSING_INTENTS');
^
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
bruh
did you include intents?
fixed
^_^
no i had one extra piece of code
it wasn't needed
nevermind wasn't fixed
am i missing something here
that is what the error says
when did they start requiring intents for command handlers
that wasn't a problem a week ago
not for commands handlers, its been a requirement for djs clients since v13
technically it was a requirement in v12 too, but it defaulted to all
v13 goes to api v9 which requires intents
why does this js for (let player in players) { if(players[player.keeper === true]) { await keepers.push(`**${players[player.name]}**\nPower: ${players[player.power]}\n\n`); } } return nothing in the "keepers" array
because [player.keeper === true] is a boolean
i assume players[true] or players[false] isnt what your trying to do
finally fixed
it has to check if for example this json "testkeeper2": { "name": "Testing keeper 2", "power": 100, "keeper": true } is a keeper (true) or not (false)
two new issues
you are not doing that though
embed, and message content cannot be an empty string
thats the part i understood
TypeError: Cannot read property 'fetchReply' of undefined
code?
How do i check if an image is sent in djs v12?
check if theres something in attachments.
https://discord.js.org/#/docs/main/v12/class/Message?scrollTo=attachments
https://pastebin.com/VMSDWuG5 discord doesn't like long code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
oh wait wrong one
well actually that one needs fixing too
whats the error in that one?
how do i have to do it then
cannot send empty message
presumably, players[player].keeper === true
finally someone who actually helps, thanks
try
interaction.reply({ embeds: [embed] }); instead of interaction.reply(embed);
YES
here's the other one: https://pastebin.com/BZeLFRqX
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
the error is included in the link
double check client.ws.ping is actually giving a response.
oh wait it wont be
since client isnt logged in
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
is a new, non logged in client.
in the code you gave me its not needed
you shouldnt need a new client, unless you plan on logging into discord every time a command is run(pls no)
i'm sorry, i mean i'm importing old code to command handlers
oh boy
ok so one more thing
let's say i wanted to find guilds, would I just still use eval
i mean like if i were to find the amount of guilds the bot is in, i would just find it through the eval command still?
i know how to do it, it's just i'm worried it would still require client to be defined
no matter where you are, you can get your logged in client
because the code would be like "client.guilds.cache.size"
for example, in a command run, interaction.client would give you client
why? ๐
some commands will require client to be defined
so instead of causing multiple clients to be logged in, getting rid of the commands that require that will make it easier
or just use const client = interaction.client
๐
or just use interaction.client directly
@fiery flame mamy dl addakm war gra kame eshm peta
When I do this:
await client.application?.commands.set(data);
The slash commands dont appear in every server. The appear in no server
Global commands need up to 1 hour to be visible in all guilds
Ah alright
and what if a bot joins a new server? How do I set then the slash commands there?
This optional chaining doesnโt make sense either, as commands is always a property of the application base
No commands means itโs an empty collection
New slash commands will be rolled out automatically if the bot joins a new server as long as the invite contain the commands scope
and if I do this?
client.guilds.cache.forEach(server => {
await client.guilds.cache.get(server.id)?.commands.set(data)
});
@boreal iron
can anyone explain what is this doing?
var onDataCallbackRecaptcha = function(e) {
document.getElementById("verification_string").value = e, document.getElementById("continue_button").style.display = ""
},
onloadCallbackRecaptcha = function() {
grecaptcha.render("recaptcha_element", {
sitekey: "6Lc5hC4UAAAAAEx-pIfqjpmg-_-1dLnDwIZ8RToe",
callback: onDataCallbackRecaptcha,
theme: "light"
})
},
onDataCallbackRecaptchaHard = function(e) {
document.getElementById("verification_string_hard").value = e, document.getElementById("continue_button").style.display = ""
},
onloadCallbackRecaptchaHard = function() {
grecaptcha.render("recaptcha_hard_element", {
sitekey: "6LdA778UAAAAAMsE9lC5_SPIOI3kwK2qNMshCu0o",
callback: onDataCallbackRecaptchaHard,
theme: "light"
})
};
I dunno JS and stuck here
Whats the error?
no error i wanna what does this code do
Why would you do this?
The purpose of guild commands is generally for testing things
kinda like what does that e mean and all
and why are they declaring function inside function
What happens when i call onDataCallbackRecaptcha
After deploying a global command on your testing server and making sure it works, itโs the next to roll it out as global command and wait an hour until itโs usable anywhere
how can i sync all channel permissions from the category
without going in particular channel and clicking sync now
is that related to bot or server? i dont get it
probably yes hard to find
i just need to find out that how can i sync all channel from the category
my all channels are in sync
but when i change catergory perms
they unsync
how to use a template
add xenon to the server you wanna use the template on
then?
then you can search up google for templates or if any server owns the template then just say them to give thier template link and then add it to the xenon it will generate a code with that code you can change your server to the exact template
every permisson will be same as the template you took
seems complex but i will give it a try
if you face any issues you can feel free to dm me
so yah thanks
my bot is still not replieng
spent 3 days figuring out the errr
and here;s the code
const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.once('ready', () => {
console.log('Ready!');
});
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
const { commandName } = interaction;
if (commandName === 'ping') {
await interaction.reply('Pong!');
} else if (commandName === 'beep') {
await interaction.channel.send('boop')
}
});
client.login(token);
22ms
what error?
the bot doesnt replies anything.
K
did u upload the commands?
Did u register the command?
I mean it doesnโt work magically.
Does someone here know Canvas and has a lot of time?
Cuz I wanna make a profile command
nvm
let channelID;
let channels = guild.channels.cache;
for(let key in channels) {
let c = channels[key];
channelLoop:
if(c[1].type.toLowerCase() == "guild_text" {
channelId = c[0];
break channelLoop
}
}
ch = guild.channels.cache.get(channelID);
ch.send('Thanks for inviting me, you can use +help or +h to view my commads!')
})``` why da fook isnt this working or am i just stupid
its not giving me a error code
or anything
You're not defining channelID anywhere
It looks like you have a typo near the middle of your code
sensitive case kekw
channelId should be channelID
also .cache returns a collection... you can shorten that for loop to a one liner with .find()
alr bet
i changed it to this
so its a embed now
Thanks for the ping ๐
do i still not have reply mentions off
sorry
it keeps turning back on every time i start up discord
sad times
is anyone using Golang for their bot?
do i still not have reply mentions off
Huh is there a way to do so?
looks like an epoch fail
groan
wasn't discord planning to add message scheduling?
wait what
hows that possible
are there any discord rules about creating a skinned clone of your own bot?
like is that against the rules
if i create a team will they have access to all my bots or only ones i specify?
anyone have this file for the dog
like the image?
F12 > inspect element > href
for me F12 doesnt do anything
let channels = guild.channels.cache;
textchannels = channels.filter(c => c.type == "text");
cnl = textchannels.map(c => c.id);
console.log(cnl)
ch = guild.channels.cache.get(cnl[0]);
console.log(ch);
const Embed = new Discord.MessageEmbed()
.setTitle('')
.setDescription(``)
.setColor(`RANDOM`)
.setURL(``)
.setTimestamp();
ch.send({embed: Embed}).catch((e)=>{console.log(e)});
})```
This Is If You Want To Have A Message Sent When Your Bot Joins a Guild
**IMAGE FOR E.G**
how do i update a collection with the new mongoose update
TypeError: Cannot read property 'split' of undefined
trying to do args with interactions and command handler
whatever you are doing .split on is undefined, what is it?
i am trying to use args in a command handler
you need to define args then
lemme see
const args = interaction.content.split(/ +/).slice(1);
i'm not sure if i did it correctly
aigh quick tip
slash commands or any interactions doesnt have a content

so it would be interaction.split
no i will
btw how u get args is by
<CommndInteraction>.options.get("argsname")
@grim aspen ^
read djs docs for more methods on getting args like .getUser("argsname")
the thing is i've been using discord.js v12 a year ago and i discontinued my bot til now. i am trying to merge my old code into command handlers. it's that one line of code literally worked with v12. i am trying to get through the struggle of being a dumbass with command handlers.
Hello I am making a website for my bot and I am making several pages for the site all worked well but when I leave on another page on the link of the site it puts name-of-site/exo.html it puts the name of the file for the second page and how I could make it put name-of-site/commands please?
did you read what i said?
unless u do some magic
might help to read the changes
i have never used command handlers til just this month
But only slightly ๐ค
every change listed in one location
handle every single one, all at once.
for example, if you used the old arg system(making it yourself, to using interaction params), swap every command at the same time to the new one
will save you a ton of time
The code and split options have also been removed. This functionality will now have to be handled manually, such as via the Formatters.codeBlock and Util.splitMessage helpers.
fuck
it literally says it has
error?
...
how do i update an index in a collection or something with the new mongoose update
in the html guide you sent, it says split has been removed
lemme go back into my code real quick
Hold my keyboard
Watch me break js in 3 easy steps
String.prototype.split = undefined
String.prototype.split = String.join
that took u long enough to write that jk
kek
Mobile
imagine if djs did that
i'm going back to v12 til i can learn v13
i'm too much of a dumbass with command handlers, and the code is too complicated for me to even use
That's not a wise thing to do
well it's the only thing to do when you have to learn v13
THAT'S WHAT I'M DOING
Which will die very shortly
But u said you're going back to v12
until i can learn v13
Learn while you use it
V12 is not a solution, it is bound to die when message intents become a thing
i can probably figure it out before then
v12 wont die just from that
isn't v12 going to not be a thing in december or something?
its deprecated and no longer supported, but discord hasnt released nor announced any change that would break it yet
v12 supports intents, so the message intent wont break it
it just wont support new features
it should still be usable for a while
then that should give me time
so v12 gonna day next year then
die*
shit



