#development
1 messages · Page 1526 of 1
imagine
Does anyone know any open-source music bot
theres a ton on github.
Woo how hard are they to setup @solemn latch
many are just download, set the token and run.
Can u link me one that's like that
some require nodejs and stuff installed.
i dont do music bots, so ive never done it, but github search is really good for finding them
*damn does not work huh?*
YO WAT DA HECK AM I ACTUALLY INSTALLING 37000 PACKAGES FOR npx create-react-app?¿?¿
well react install a lot of dependencies
But who uses 37000 dependencies
code913 does


well you also install an interpreter for jsx, a way to render jsx to html and more stuff
nice
babel isn't it?
bro
sis
get the Member object and check the account age vs todays date, use this value to determine for how old a account has to be to be accepted. if someone fails call the ban function on the member object
since discord doesnt support it directly you have to store the ban somewhere, i suggest to use Redis since you can set a TTL and if the TTL runs out it emits an event that you can listen to to unban the user
*sike*
ok
Any good hosts you guys would suggest for my bot?
check the pins,
personnaly:
Digitalocean
AWS
Google Cloud
Vultr
Linode
actually go for VULTR
I've used them and they're good
Galaxy gate is my personal suggestion
Some Use Heroku but when your bot is gonna grow it's gonna cost hell lot
But everyone recommends what they personally experienced as good so 🤷♂️
i do not recomend OVH tho, sure they are relatively large but ive tested various products they offer and all of them had theyre issues
Hello! I'm getting this error ```js
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
CODE:
```js
Client.on('message', async message => {
const data = await prefix.findOne({
GuildID: message.guild.id
});
if (data) {
const prefix = data.Prefix;
use a try/catch block around the db call
hmmm, i'm using discord.js, and i would to implement shards, the problem is, when shard 0 starts, all is good, but when shard 1 starts, now port for dashboard is in use (by shard 0). How i can repair that?
in my index.js i'm require("dashboard.js")
Put your dashboard in the sharding manager instead of the bots.
hmm
@solemn latch but when i'm doing require("dashboard.js")(client) i'll do require("dashboard.js")(shards)
?
const { ShardingManager } = require("discord.js-light");
const config = require("./assets/JSON/tokens.json")
const moment = require("moment");
const shards = new ShardingManager('./index.js', {
token: config.betaMafinka,
totalShards: 3
})
shards.on("shardCreate", shard => console.log(`[${moment().format("YYYY-MM-DD HH:mm:ss")}]: Launched shard #${shard.id}`))
shards.spawn(shards.totalShards, 10000)
my sharding manager
help
so
im doing
localhost:3000/api/eeel
doesnt work
const router = require('express').Router()
router.get('/eeel', (req, res) => {
res.send(400)
})
module.exports = router;```
```js
app.use('/api', routes);```
help
does the express server start?
yes
also maybe use res.sendStatus(400) if you just set the status not every software will pick it up
lemme try
wont work
also
i did
send({ msg: 'lol' })```
but no work
yes
if you use a router.get("/") it fires?
sendStatus is deprecated, use status instead
Show us your file tree
wait
more lines doesnt make your code better
I can write 500 lines of code that does nothing
its the other way around, sending status messages with send is deprecated
rip ignore the netflix
here.. ignore the netflx thingy. that was the max i can crop for some reason
ping me when ur here
ik
it has 300 lines because its interactive af
@pure lion https://i.imgur.com/WBMkZ2s.png
its even cleaner
also the express docs doesnt say anything about it being deprecated
const content = message.content.replace(`!eval`, ' ')
eval(content)```
lmfao
eh
again
its interactive af 
i like overcomplicating things
yes
all jokes
lol
wowie im too lazy to write a good eval command
its pog
i would record it hold on
is it open source 👀
Confusion
@young flame if you end up recording it give me a ping, I'll see it in the morning. sounds cool!
@drowsy grail to late
lmaoooo thats neat!!!
is that a cat


what people think devs do: hack into the cia
what devs really do: spend 2 hours finding a custom cursor
welp back to coding
have fun
factsss
it toook forever
lmao hey seems worth
why first getting the user from the message to then get the member from the cache?
use message.mentions.members.first() instead
aalso the way you get the member is invalid i guess
Thanks
guys does anyone know html?
hello does anyone use slappey here?
wtf is that
its a bot
ready bot
no i dont use the bot but i know who wrote it
no
is not a fully ready bot
u code the commands
and other things
but he skips for u command handlers and events and util
i didnt know how to get the commands to create a help cmd
i dont use the Bot and cant help you, ask the guy who made the template he got a discord server
he has one
is someone able to help me setup a python discord bot on cpanel
i dont send the url in here
invite me to it my dms are open
dm
your dms are closed
they arnt
okay?
so you want unique IDs?
case number #{number}
if you are on js use crypto
crypto.randomBytes(8).toString("hex"); generates an ID with 8 letters
oh
crypto is an npm module
oo
how do i check it?
like a
on!history command
?
i cant look into your brain idk what you plan to do
lol
ok so
i need mod log numbers for the action logginG
like how lucas reason command has the
#{number}
who is lucas?
H
so you want to keep track of such stuff?
case number = 1
on mod action, case number += 1
but how would you get info on that number

store it to a db
Save last incremented number in a database
that is a option
But have it cached too so that you don't pull from database every time
i have this code https://sourceb.in/3ThlxwoKvJ
And it sends this embed (sucks)
How to fix it? (CPU usage and Free memory are only wrong how can i fix that 2?)
does anyone here use slappey?
what is slappy ?
os.freemem is in bytes, you need to divide them to get megabytes, or whatever you want
and cpuStats returns this
so?
you cant send that directly
how to fix that?
im not really good whit this if i knew this i wouldn't ask help
i dont know if i knew it i wouldn't ask help
ok lets start with the memory thing first
do you know what is a byte and what is a megabyte?
nvm i fixed it
lmao
lol
Oh this is fun
Example app listening on port 8080!
And repl.co doesn't want to load my page
oh wait
I forgot to send a response on my main route
shiv you fucking twat.
no u twat
hey small question how can i make my bot say like "prefix: > say >help for help"if he got pinged
why then not make the mention the prefix? additional to the prefix?
so you can run the help command and list in there the prefix as example
because i already know how to do that but how can i do it like you only mention him and than it says prefix: >
listen for mentions if it matches the bot ones send the message
Cannot read property toLocaleString() of null
what is this error?
Show your code
Lol
no bot is added
the bot is leaving the server
Users count is a null dafuq?
@earnest phoenix yeah
it shows me like that too
Hey guys so I have this unban command and it’s doing thus
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'unban',
run: (message, args) => {
if (!args[0]) return message.channel.send('Please specify a user ID.');
message.guild.members.unban(args[0])
.then(() => {
const embed = new MessageEmbed()
.setTitle('The ban hammer has spoken!')
.setDescription(`<@${message.author.id}> unbanned <@${target.id}>`)
.setTimestamp(new Date())
message.channel.send(embed);
})
.catch(err => message.channel.send(`I can't find a banned user with this ID: ${args[0]}`));
}
}
But it does unban the user but just says that
maybe log the error that you not properly handle
hey guys
let scheduledMessage = new cron.CronJob('00 30 10 * * *', () => {
const args = message.content.slice(Config.prefix.length).split(/ +/);
console.log(args[1] + args[2] + args[4] + args [3])
let channel = client.channels.get(args[3]);
channel.send(args[4]);
});
if (message.content.startsWith("!auto")) {
scheduledMessage.start()
}
why is my command not logging anything to the console?
run it at an interval and check time
cron job prob didnt run if it didnt log
- less dependencies if you dont use that
how would i make an interval of that high?
just do interval of a minute or something and check time
Why is this unban command doing this
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'unban',
run: (message, args) => {
if (!args[0]) return message.channel.send('Please specify a user ID.');
message.guild.members.unban(args[0])
.then(() => {
const embed = new MessageEmbed()
.setTitle('The ban hammer has spoken!')
.setDescription(`<@${message.author.id}> unbanned <@${target.id}>`)
.setTimestamp(new Date())
message.channel.send(embed);
})
.catch(err => message.channel.send(`I can't find a banned user with this ID: ${args[0]}`));
}
}
^^ btw no errors
It unbans but just says that
something is wrong in the then callback then
in the catch func add console.error or log
so the error will show up
u just send that message currently
You don't define target anywhere
oof yea tho
just do args[0]
Huh
Where do you define target
No where...
My bad
Which is faster and more efficient?
if(true) { } // 1
if(1 == 1) { } // 2
the difference is so small that you won't notice a difference, but probably the first one, because in the second one you create two number literals
@cinder patio ```js
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'unban',
run: (message, args) => {
if (!args[0]) return message.channel.send('Please specify a user ID.');
message.guild.members.unban(args[0])
.then(user => {
const embed = new MessageEmbed()
.setTitle('The unban hammer has spoken!')
.setDescription(`<@${message.author.id}> unbanned <@${user.id}>`)
.setTimestamp(new Date())
message.channel.send(embed);
})
.catch(err => message.channel.send(`I can't find a banned user with this ID: ${args[0]}`));
}
}
Better?
the javascript engine probably optimizes it
try it
I don't see anything wrong
Cannot destructure property 'type' of 'undefined' as it is undefined.
Cannot destructure property 'type' of 'undefined' as it is undefined.
Cannot destructure property 'type' of 'undefined' as it is undefined.
Why does this randomly keep happening in my React Components
The error is from the render method of a Component
It's here:
render ({ type }) {
// ...
}
I'm using the Component in my app here:
<SourceInput type="x" />
@quartz kindle timmy plz halp
no
ew are you using class components
yes?
im just starting out
im pretty sure you can't pass props like that with class components
you should use react hooks altogether instead
Huh?
I've been using it like that for so long
render has no args iirc
use props instead
the snippet you provided is mixing hooks and class components
whered you get that
🤔
like this
this.props contains all the properties u pass to the component tag
so in ur case it'd be this.props.type
just don't forget this
@lyric mountain thanks
i mixed normal function components with class components >:(
hey guys
why does my bt send me cannot send an empty message? ```js
if (message.content.startsWith("!auto")) {
const args =
message.content
.slice(Config.prefix.length)
.replace(/^auto/, "")
.replace(/<#\d+>/, '')
.trim();
fs.writeFileSync("./first.txt", args);
let data = fs.readFileSync("./first.txt");;
let channel = message.mentions.channels.first();
channel.send(data);
}```
the txt file does have the lines i input
console.log data, make sure the encoding is utf8
If i dont have any constructor in my class it would just call super with the provided arguments anyways right?
idk, never tested
@eternal osprey please for fucks sake use a normal database
constructor(props) {
super(props);
}
just put this in the beginning of the class
try seeing if it does work without it tho
cool
@eternal osprey hey yo
@eternal osprey hey yo I got a surprise for you
My bad for 2 Pings lol
HELP ME
Huh?
BOT HAVE LAG AND BUG
We can’t never help without the code..l
@earnest phoenix
Bruh
Bruh, just show the code

Is that tHe full code?
And what’s the error
@earnest phoenix well it has happened with me, nan it’s just 0 but you can fix it but I’m not that pro so yea...
Ping woo, evie, code, Googefeud if you want professionals
@cinder patio maybe you can help him
if (message.content.startsWith("!auto")) {
let rawdata = fs.readFileSync("./channel.json");
let sent = JSON.parse(rawdata);
let data = fs.readFileSync("./append.json");
let args1 = JSON.parse(data);
message.sent.send(args1);
}```so the data i want to send and the channel id are in the 2 json files i declared
but why do i get this error:
Cannot read property 'send' of undefined
stop storing data in json
i dont think so
you can't control how it displays to the end user
you can maybe try adding 3 inline fields but i doubt that's going to work
you're at the mercy of discord's css
okay
are you still using a json db?
you save everything in json lol?
no this is some other project i work on
if (message.content.startsWith("!auto")) {
let rawdata = fs.readFileSync("./channel.json");
let test = JSON.parse(rawdata);
let data = fs.readFileSync("./append.json");
let args1 = JSON.parse(data);
test.send(args1);
}```do you know why this gives me: test.send is not a function
for configs fine
yeah i understand
but if you have to write its bad
also i love winscp. its so super slow when downloading a lot of small files
i know
anyone?
but atleast the new Server is worth the money
did a small test and where the old one ended up with 75% Utilisation the new one doesnt even notice it
Try to make the args[0]
has nothing to do with it
test.send is not a function
well no shit
but my question is, how to fix it and why is it not a function.
(node:15924) UnhandledPromiseRejectionWarning: TypeError: test.send is not a function
They're using a json db
thats not even json lol
JSONs are objects 
s!eval let i = null
for(i = 0 ; i < blacklisted.length ; i++) {
let lol = client.users.cache.get(blacklisted[i])
lol.send("You have been Blacklisted from using bot for one week! We are really sorry but you know what you did. If you want to be removed from "The Black List" earlier , then join our support server - and appeal in `#support` channel!")
msg.author.send("You have been Blacklisted from using bot for one week! We are really sorry but you know what you did. If you want to be removed from "The Black List" earlier , then join our support server - and appeal in `#support` channel!")
}
oh wait
hey i had a little question
how do i let a certain command run every 24hours?
setinterval right?
Hi there
I need some advice warning discord bot owners (not only server admins) about an ongoing token leak I discovered.
I'm running a discordjs loop that loads all retrieved tokens in order to send a warning from the bot.
I'm currently sending PMs to guild owners via client.guilds.cache, and I was expecting bot owners to be in there too, but someone told me he didn't receive any PM from his bot.
I guess permissions and PM policy come into play (cache, maybe ?).
Any idea to achieve this ?
let i = null
let blacklisted = ["583002121872474122","295216225636581377","521383016325709825","566193564502196235", "526942791419428885" ,"495965902345469955", "594972758778314752" ,"699543638765731892", "558861606063308822"]
for(i = 0 ; i < blacklisted.length ; i++) {
let lol = client.users.cache.get(blacklisted[i])
lol.send("You have been Blacklisted from using bot for one week! We are really sorry but you know what you did. If you want to be removed from The Black List earlier , then join our support server - LINK and appeal in #support channel!")
}
My Code
TypeError: Cannot read property 'send' of undefined
Yes?
how many times u gonna change it?
That user isn't in cache
YO ARE YOU RUNNING A FOR LOOP TO DM ALL BLACKLISTED MEMBERS
Use Promise.all() to fetch them all
Just do it once
When they get blacklisted
No need to constantly trouble them
Yea but I just made that array
I have problem about installing sqlite3.
Can you upload the full stacktrace to a site like hastebin.com
What’s that?
As it stands, all that screenshot shows us is what command was run and it failed
What's what, hastebin?
No the coding what is he tryna do never seen that
They're trying to install sqlite.
its a build error
Ohh lol
What’s your bot btw? Never got time to ask that

Oh yeah I can do -bits
Bots*
I created a new empty directory. There is an empty app.js file in that. I tried to install discord.js, sequelize and sqlite3 as last one.
What is stacktrace?
@quartz kindle you are smarter than me, did you know an way with how to profile the memory usage of a node process. got a Bot that used d.js-light that got after 30 minutes already 800mb Ram used (reported by pm2)Most caching is disabled and currently only 1 guild is used by the bot
Lol
i keep now htop open and see if i get there something
not much, listen for messages and then use tensorflow to determine if the message is toxic or contains harmful text
on my old server it where around 150mb on the new one that got way more ram it skyrockets
It’s telling me I’m missing a (
find the missing (
2 things. you got 1 { opening the object but 2 } closing it. and Discord.js will parse a user or member object to a mention when you call it inside a string like you do it.
Imagine laughing at yourself
Every day man
When life gives you more RAM, ${aboose}
wired installing the optional packages discord.js recomends helped, also got now jemalloc running
nah the process could use 30GB ram i would not care
Holy shi-
my server got 64GB so
Wtf
Chrome gets unstable at around 1.2TB ram used
@earnest phoenix did you find the missing (
when did you open over 600 tabs at once?
Line 24
@earnest phoenix i think u missed the {embed:
But, I don’t want embed tbh
@earnest phoenix why do you have 2 https://i.imgur.com/5E9xrGn.png
remove one of the }
Alrighty
idk what helped but now it is stable at around 350mb for the stuff that runs i guess its fine
why ?
If I don’t want it embed its if (!target) return message.channel.send(description) right?
Mhm
just send a string then
message.channel.send(`message`)
Alr
did you remove the } ?
you maybe could listen to the vouceStateUpdate
Hey why i am not able to import cv2 when it is installed in my machine
are you using intents? if so you're going to need to add another one to get that event
Because it's <VoiceState>.channel
The voiceStateUpdate event returns instances of VoiceStates, not GuildMembers
voiceChannel is not a thing anymore anyway
not since v12
voiceState.channel like voltrex said
voiceStateUpdate gives you voice states not guild members
Username of the member who got it's voice state updated?
<VoiceState>.member.user.username
@frigid flame https://cdn.hopefuls.de/iZVm
your application icon
not your bot profile icon
@rustic nova thank you so much you are great 😀
Did you enable them on your developer portal aswell?
no the intents in dev portal
Huh guys
@earnest phoenix did u fix what I told u to do
Mhm!
is ur command working now?
Btw
ok good
Should I add GitHub link for command list or a designed picture with the commands?
a picture would be nice
Yea same I was also thinking that and it would also be unique don’t you think?
How would I get the url of a Discord.js MessageAttachment that I create?
Huh what do you mean?
I used discord.js to create a message attachment, how would I get the url for that attachment
https://www.npmjs.com/package/click-here-wandavision-now these scammers and iploggers are really getting desperate huh 😭
I've two child classes of a parent class. I want to run a method of child-1 in child-2
abstract class Parent {
abstract sayHello(): void;
abstract getGreet(): string;
}
class Child1 extends Parent {
sayHello() {
console.log(this.getGreet());
}
getGreet() {
return 'Hello there!';
}
}
class Child2 extends Parent {
sayHello() {
// I tried this, but it is calling the getGreet method from this class method
Child1.prototype.sayHello.call(this);
}
getGreet() {
return "I don't want to run this.";
}
}
Why i can't use music commands? new update in ytdl-core?
pretty sure you can only either execute the method in one context or another
meaning you can't call methods in a context separate from the one you called the main method on
hmmmm, actually I just want the this in Child2 to behave like as if it is of Child1
i just thought that was java 
fml
then just use call()
Haha, its ts
yeah just realized 
classes be lookin fresh tho
I tried using call(), but the getGreet method is being called from Child2
Curious, why would you want to do this? I think this goes against the principles of OOP
yeah, because you're calling it using Child2's context
afaik, the only way to do this is by getting an instance of Child1
Part of my code:
client.commands.get('help-user').execute(message, args);```
error I get: ```/Users/norbert/discord-nikola/index.js:73
client.commands.get('help-user').execute(message, args);
^
TypeError: Cannot read property 'execute' of undefined
at Client.<anonymous> (/Users/norbert/discord-nikola/index.js:73:41)
at Client.emit (node:events:327:20)
at MessageCreateAction.handle (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/Users/norbert/discord-nikola/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (node:events:327:20)
at Receiver.receiverOnMessage (/Users/norbert/discord-nikola/node_modules/ws/lib/websocket.js:825:20)```
Could you help me please?
the command 'help-user' doesn't exist
use super
The super keyword is used to access and call functions on an object's
parent.
thats what they want no?
nope
hmm, so its not possible.
anyway thanks guyz
capital C in color

Tell how to Get whitelist ip from mongodb
idk what you're using
yeah because you haven't done anything yet
Bro
mongodb atlas?
network access tab
idfk
Next
hi, what is the site to learn discord bot commands?
there's an "add ip address" button
add "0.0.0.0/0" to allow access from anywhere
Yes next
that's it
message.channel.send(`${bot.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)}`)
its returning NaN
you sure you're running the latest code?
owner is null
i hope so/
i mean did you save your code last time you ran the bot
sometimes that shit happens
i did it even in eval,
o
returning NaN
setColor with capital C
owner is already a guildmember
you're using setcolor, it should be setColor
please help
wait where's the msg.guild.owner.user.tag the error is referring to?
this
or where is the user
This would've been solved over 30 minutes ago if you read #development message
no clue then 
client.user.displayAvatarURL()
according to the docs, you're doing it the right way
no clue why it is erroring though
Guild#owner, fetch it to make sure that it's cached (Guild#members#fetch(Guild#ownerID))
cause discord.js is gae
glad that i'm coding in the more stinky language called Java 
so thats why u also stinky?
programming is case sensitive
hi tim ❤️
hi :3
does your bot have the correct permissions?
does. YOUR BOT, have the correct permissions
not the user running the command
Pls help
Got a question or just in general need help?
you will need nodejs 12.x or higher to use discord.js v12
Looks like an error to me
yes
Oh thought you said it wasn't facing errors 
How
No idea, but it's irrelevant, glitch is not an appropriate place to host bots.
From install pakage
They ban anyone that uses pinging services to keep their bot alive, so it won't be 24/7. You should find an alternate hosting service.
ma'am*
where can I know how many server are my bot currently in?
dw about it, sir is like a hard stop for indians for some reason.
replace sir with . and everything makes sense.
Your library should have a way to know how many guilds you're on. What programming language and library are you using?
python
i am also from india:sweat_smile:
Yes, that's what I'm saying. As a rule of thumb, stop using sir everywhere, that's not how people use english normally. And there's also a thing called women in the world, gendering every single one of your sentences is bad practice.
Lol
can i get the owner tag on guild join?
All of us are a community ........so we are like buddies
i've just try it and i got DiscordAPIError: Missing Access
what did you try exactly?
guild.members.fetch
guild.members.fetch(guild.ownerID)
that's where the error come from
That's interesting. "Missing Access", really? I haven't seen that error before, that I can remember.
oh wait
thats error happen when the bot leave the server
i think i got it
hopefully

yup its working now
is this the correct way to find emojis;
if (!emoji) return msg.channel.send('Could not find that emoji, returning.')```
cuz its not working
and yes its probably wrong, i never used a find function on emojis
ah nvm i added : on both sides
I'm assuming emojiInput is a discord collection that has messages in it?
it collects emoji names
not the actual emoji
brain fart right there
for (var i = 0; i < array.length; i++) {
m.react(array2[i].id)
}```
cannot read proeprty id of undefined
for m.react(array2) part
1st - Google images
2nd - image collection
3rd - profit
how do you make an anchor in djs?
like a link
but it hides the https part
and replaces with words
what
masked links
you can use markdown for that [Link](https://example.com)
but only in embed descriptions and field values
k
interaction.member.user.tag
how come this doesnt work
or interaction.member.tag
or have you tried .user.tag
its an in embed
ill try user.tag
node:1607) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'tag' of undefined
interaction.member.user.username works
interaction.member.user.tag doesn;t
strange
What happens when you do interaction.member.user instanceof require('discord.js').User
Does react have a way of validating user input before putting it in DOM?
extra hardwork
nah its really easy
is there any place we can learn the reason of being rate limited and the remaining time (client.ratelimit is emitted only when hitting the limit and does not support these kinda info)?
you'd have to look for the raw headers sent by discord
found it
headas sent by discord
I summon the JS gods
this method (setPixelColor) demands a callback function as the last argument, but for some reason it errors when I pass an arrow/normal function
any ideas why or what should I put there?
ah, nvm, that is an optional ain't it?
The ? means optional, but I don't understand JS/TS typings. There's ?cb: T, cb?: T, cb: ?T and cb: T? unless one of them are syntax sugar for the other.
how can i do that when i start a command like ;something #test #test2 #test3 or ;something 272764566411149314 385837258768515083 385837258768515083 i can take the ID of all the channels mentioned?
You could read the message content
Since it'll look like ;something [#123](/guild/264445053596991498/channel/123/) [#456](/guild/264445053596991498/channel/456/) [#789](/guild/264445053596991498/channel/789/)
split by space, remove the first element (cause it's your command name) and attempt to parse every item in the array
use message.mentions.channels
there's probably a better way with your library
still getting that error, just updated node
i have this const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first(); but only detects the 1st mention
well guess why
a
hint: look at the end

that callback is driving me nuts
Can you jump to the definition of ImageCallback
Maybe the callback is drunk i guess? May you show us what the code of the function looks like? setPixelColor.toString()
what exactly u need to see?
nvm, gonna use hastebin to share the whole ImageCallback
...which is not working
Is that what came out when you did toString() on it or
nope, that's ImageCallback definition
gonna get toString result
returned this:
function setPixelColor(hex, x, y, cb) {
if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input
x = Math.round(x);
y = Math.round(y);
var idx = this.getPixelIndex(x, y);
this.bitmap.data.writeUInt32BE(hex, idx);
if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}
return this;
Part of my code:
client.commands.get('help-user').execute(message, args);```
error I get: ```/Users/norbert/discord-nikola/index.js:73
client.commands.get('help-user').execute(message, args);
^
TypeError: Cannot read property 'execute' of undefined
at Client.<anonymous> (/Users/norbert/discord-nikola/index.js:73:41)
at Client.emit (node:events:327:20)
at MessageCreateAction.handle (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/Users/norbert/discord-nikola/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/Users/norbert/discord-nikola/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (node:events:327:20)
at Receiver.receiverOnMessage (/Users/norbert/discord-nikola/node_modules/ws/lib/websocket.js:825:20)```
Could you help me please?
Let me check...
check first if the command exists, then execute it
yes, I missed it. Sorry😕
Wait how's it throwing that error? It doesn't have anything defined to throw it, or that's an error from TS?
when the code reaches that part, it simply yells "cb must be a function"
if I pass null value, the error changes a bit:
So it's coming from (0, _utils.isNodePattern)(cb)
Oh it's from isNodePattern
I swear I hate debugging js
I have help-user.js file in my commands folder and other commands work.
Part:
client.commands.get('info').execute(message, args);
} else if(command === 'user'){
client.commands.get('user').execute(message, args);
} else if(command === 'help-user'){
client.commands.get('help-user').execute(message, args);```
From the commands sent above only help-user doesn't work.
What is it? And why only this command doesn’t work?
i got no idea how you register commands
dynamic command handling lets you find and run commands without the need for a giant if/else chain
do you have a command named help-user?
Has a command handler
Uses if..else chains to identify commands
What's the purpose of the command handler if you're doing that then
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'help'){
client.commands.get('help').execute(message, args);
} else if(command === 'join'){
message.author.send(`test join info`)
} else if(command === 'warn'){
if (message.author.flags.has.MANAGE_MESSAGES) return;
const user = message.mentions.users.first();``
if (user) {
const member = message.guild.member(user);
let q = args.slice(0).join(' ');
member
.send(`**You have been warned for** ${q}!`)
}
} else if(command === 'announce'){
if (message.author.flags.has.MANAGE_MESSAGES) return;
client.commands.get('announce').execute(message, args);
} else if(command === 'embed'){
if (message.author.flags.has.MANAGE_MESSAGES) return;
client.commands.get('embed').execute(message, args);
} else if(command === 'info'){
client.commands.get('info').execute(message, args);
} else if(command === 'user'){
client.commands.get('user').execute(message, args);
} else if(command === 'help-user'){
client.commands.get('help-user').execute(message, args);```
This a part of my index.js

How can I get a message in a different channel by ID and edit it in discord.js v12? I've tried:
client.channels.cache.get('1234567890123456789').messages.fetch('1234567890123456789').edit('New Message');
```but I get an error saying that edit is not a function...
messages.fetch returns a promise
<TextChannel>.messages.fetch() returns a promise
tried that too, same issue
you can't require images
Yeah, I used .then and it didn't change anything
use a MessageAttachment
It doesn't straight up put in the image, you first attach it, then set it
use attachFiles([attachment]) to attach it and set the image to attachment://your-attachment-name.gif
@earnest phoenix
client.channels.cache.get('1234567890123456789').messages.fetch('1234567890123456789').then(msg => { msg.edit('New Message'); });
```has the same issue
guys sorry but who can sand me invite in brawl box bot pls?
What's the "issue" exactly
maybe the message doesn't exist
it does exist, double checked
But
or the message isnt cached
What's the issue
edit() is not a function
Is there another way to fetch messages?
Log what msg returns
It's not undefined
It would say can't read property 'edit' of undefined if it was actually undefined
again, you can't require images
wait yeah 🤦 that is what it says, was looking at the wrong log
the first argument is the source
if its undefined then it doesnt exist or isnt cached by your bot (someone correct me if im wrong)
which would be the file path relative to the project root
Is there a way to force-cache it? I thought d.js auto-caches stuff if it can't find it
@earnest phoenix
https://discordjs.guide/popular-topics/embeds.html#local-images
lol
no
isn't it an array
o
<BufferResolvable> can also be the path to the file
pretty sure the image path is not relative to the file
@mellow kelp so how can I fix it?
it's relative to the project root
well check your syntax
I tottally, absolutely hate JS debugging
turns out the error was in a totally different place
Pain
welcome to another episode of "debugging javascript"
@mellow kelp think I might have found it... It seems to be retrieving every message in the channel, even though I only asked for one. Any idea how to fix?
make sure you're passing an id to the fetch() function
99% sure I am, can double-check tho
It should return a single message if you're passing an ID
🤦 I'm not lmao
my bad
It was a totally different part of the code
the message wasn't storing in the DB
.attachFiles()
That method belongs to the MessageEmbed class
Not a global function
Of course
thats what i was telling you before
the file path you have to set is not relative to the current file
it's relative to the folder where you run the bot
is your gif in the root directory of your project?
just do file.gif
I'm pretty sure you gotta add ./ at start, but not too sure
Can you show your new code
Nah
i mean it wouldn't let me do that in typescript
Weird, i always pass an actual object to it
panik
you need the extension in the attachment protocol
i havent used either in awhile, but isnt there attachFile and attachFiles
Nope
ah
🤔
I believe attachFile was removed in v12
oh i thought you were saying no to me
lmfao
Ex dee
it's not weird
You need an extension
^
discord doesn't assume the extension
attachment://attachmentName.extension
since you can upload extensionless files
🤦
Bruh

your extension is .gif
not .extension
What's your new code now
set the name to matze.gif
That file doesn't seem to be a gif tho
they're renaming it so it doesn't have an extension
can't you read your own code 🙄
Yea set the name
if it doesn't work after that
it isn't a valid gif image
Wait
Is that a custom background

glasscord
Isn't that like a client mod?
technically yes
But client mods are against ToS tho
like they would care
invites are channel bound, not guild bound
you need a channel
I thought actual Oliy was typing
<GuildChannel>.createInvite()
oliy was typing 
After how many shards should I consider clustering?
you should cluster when your systems cant handle so many shards.
Yes
what's the ratelimit to set a channel's slowmode?
Define "can't handle" please
it's a promise, resolve it with promise then pattern or async/await
maxing cpu usage, ram usage, network usage.
generally you wont start clustering until you have such a large bot a good dedicated server cant handle it.
depends what you mean by "clustering"
as that word is used for many things
often wrongly
Ok. Mine's in close to 6k right now. I guess I'm ok for the moment
if you mean spreading your bot into multiple machines, you probably wont need that anytime in the future
if you mean packing more shards in less processes, thats always a good thing to do
pretty sure there are bots with over a million servers without clustering right?
(spreading over multiple machines)
most definitely
Ok. Thanks for info. I'm on 5 shards right now and my VPS is handling it fine.
Just saw some bots were clustering and was wondering what that meant
most likely they mean the second option i mentioned
as many processes as you have cpu cores
badge = req[f"{req_id}"]["Request"]
KeyError: "{'Request': 'Actual Scopes :Scopes:', 'User ID': '510736807999307786'}"
I get this error when i use a command which should read the "request" in the "req_id"
My code :
# WHERE I SAVE THE REQUEST AND USER ID UNDER THE "REQ_ID"
@commands.command()
async def badge(self, ctx, *, arg):
channel = self.client.get_channel(798957437398548500)
with open('requests.json', 'r') as f:
req = json.load(f)
num = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
Id = (''.join(random.sample(num, 6)))
req_id = Id
req[str(req_id)] = {}
req[str(req_id)]['Request'] = f"{arg}"
req[str(req_id)]['User ID'] = f"{ctx.author.id}"
with open('requests.json', 'w') as f:
json.dump(req, f, indent=4)
# THE COMMAND I USE TO ACCEPT THEIR BADGE REQUEST
@commands.command()
@commands.has_role('a role')
async def acceptbadge(self, ctx, req_id):
with open('prof.json', 'r') as f:
acc = json.load(f)
with open('requests.json', 'r') as f:
req = json.load(f)
member_id = req[f"{req_id}"]["User ID"]
member = self.client.get_user(member_id)
req_id = req[f"{req_id}"]
badge = req[f"{req_id}"]["Request"] # THE ERROR IS ON THIS LINE
current = acc[f"{member.id}"]["Badges"]
if current == 'None :NoVerify:':
acc[f"{member.id}"]["Badges"] = f"{badge}"
else:
acc[f"{member.id}"]["Badges"] = f"{current}\n{badge}"
req.pop(f"{req_id}")
with open('prof.json', 'w') as f:
json.dump(acc, f, indent=4)
with open('requests.json', 'w') as f:
json.dump(req, f, indent=4)
hastebin plox
nice wall of text lmao
lmao alr hastebin
Using something like this Tim? https://github.com/brussell98/megane
are all discord ids 17-18 digits long? /\d{17,18}/
Ok. I'll start looking into it. Bot is joining about 1k new servers / month I just don't want it to get out of hand and wake up too late 😂
i think they're up to 19 digits now
realistically, 20
the number of digits increases as time passes, because of the timestamp component
wow, any less than 17?
20 would be the max
20 should be good for what? a few decades?
nice
someones planning to have their bot up a long time 
like take discord's epoch, see when the max ID could come out and boom
censoring IDs 🤔

why a cronjob
