at MessageCreateAction.handle (/rbd/pnpm-volume/e351023a-4fe3-4f35-8806-4732f9a73518/node_modules/.registry.npmjs.org/discord.js/12.1.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
(node:857) 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(). (rejection id: 3)```
#development
1 messages ยท Page 861 of 1
at MessageCreateAction.handle (/rbd/pnpm-volume/e351023a-4fe3-4f35-8806-4732f9a73518/node_modules/.registry.npmjs.org/discord.js/12.1.1/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
and
(node:857) 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(). (rejection id: 3)
uh wait lemme download gyazo
@scenic nest wait can i see the code as an screenshot in the glitch code editor?
there ๐
Wait... Lemme get my telescope...
@scenic nest can you zoom on it lmao?
congrats you managed to show literally everything but the error
He asked for the Code though and not an error 
@scenic nest wait you can put everything that was stored in the description without doing it like that
Lemme show you what i mean hold up
.setDescription("__**Commands list**__\n>`play`>(`play [title/url]`)\n>`Skip`, `stop`, `pause`, `resume`, `nowplaying`, `queue`")
Should have done it like that...
tomorrow*
Welp anyway cya then
@scenic nest put a " before the )
K cya
One advice from me, @scenic nest you might want to look into the documents and probably learn how to code in JS first. This channel is not here to code FOR you...
@blazing portal k buddy no need to be that pushy or mean lmao
(Ik you're not mean but he might think it as it's mean)
pushy? I wrote one line with genuine advice^^
Ik... I mean that line at the end
"This channel is not here to code FOR you..."
Basically we're mostly here to help aren't we?
He's using code literally copied from youtube tho
So i have a question and it's:
How can i fetch the uncached users?
(discord.js 12.1.1)
Hmm like i have the serverinfo command and:
memberCount: 90k
Actual users: 20k
Bots: 7k
Hmm
guild.members.fetch();
Anything inside that () block? @elder vine
K
How to stop pm2 being really annoying and making two instances
Nope
there is another instance running outside of pm2 then most likely
Yea
Does it load up two?
then your code is loading up two ๐
in pm2 logs (id)
https://corynth.is-inside.me/aIYw7Q8J.png Shows errors twice
that might not be a double thingy then
Do u get replies doubled?
do u have two message events mby?
What is in package.json?
pm2 start (id)
I would have guessed
TypeError: Cannot read property 'createChannel' of undefined
Anyone knows a way to force Discord to parse all mentions in an embed?
Darn
U can store both their username#tag + userid tho
Yeah, I can .get the members just fine
When I copy paste the <> mention it does parse correctly
mhm
Just seems like Discord doesn't want to update the mention cache client-side when it's a mention in an embed
This is either an issue or intended because a mention in an embed is actually not a real mention
I even tried forcing them into the actual mentions in the message: placeholder.mentions.users.set(data.userid, user.user);
But even after doing that and seeing all members in the message.mentions.users
Doesn't seem to parse client side until I actually mention them myself
Discord will always do that iShot there is nothing you can really do about it
Maybe if I mention them in a message above the embed
That forces Discord to actually cache client side (and skip the embed problem)
I'll try that, I'll report back
Do you really want to mention the users
It's just to be really fancy pants about it
Might be overkill
Actually it probably is
yeah.. 
Does anybody know how to get that time since registered text? I use discord.js
@slender thistle oh my bad
guildMember.createdAt
(node:1768) UnhandledPromiseRejectionWarning: TypeError: message.guild.createChannel is not a function
djs version?
// Create a text channel
if (callmevalue == true && textchannelvalue == true) {
if (typeof quote == 'undefined') { message.channel.send("Please enter the channel name in Quotes."); return;}
message.guild.createChannel(quote, 'text').catch("erreur");
}
///////////////////////////////
C:\Users\Skynoze>node -v
v12.16.1
Maybe message.guild.channels.create();?
Discord.js version, not Node version
guild.channels.create
but its the shitty one with .cache
thing
@earnest phoenix that's v12 lmao
๐คทโโ๏ธ been a wile since i didn't coded any bot so its new for me
Yea... v12 has many changes over the v11 so it's hard to get used to if you were coding on v11 pastly @earnest phoenix
They said like 5 days.
@earnest phoenix + the discordjs doc is fucked up
@earnest phoenix yea...
it took me 1h30 to make a foreach users
Not even joking
Discord.js docs are a little confusing now
@elder vine what does i change to the thing ?
they were always be
guild.channels.create
an example every 15 bunch of code
And not a complete and easy doc like php for example
Uh also how can i try to create a text channel for example know if i have permissions for it ?
did it changed ?
no, don't think so
That is seems amazingly tedious to type a full sentence just todo something lol
If you could have that in a voice channel, turn what users say to text and then have it work that would be sick
You could just design your server with your voice
lol
Ups
pretty simple tbf todo with python
(node:2384) UnhandledPromiseRejectionWarning: TypeError: message.author.hasPermission is not a function
give it enough audio and tensor flow and about a week of training and you can get it Recognising stuff ez
BUT we are talking about nodejs and not python ๐
its the poinf of a language, when you talk about one, its because u want to talk about this exact language and not another one
(node:2384) UnhandledPromiseRejectionWarning: TypeError: message.author.hasPermission is not a function
You can't get permissions of a user object, only guild members
msg.author is a user
(node:1256) UnhandledPromiseRejectionWarning: TypeError: message.author.hasPermission is not a function
Try message.member instead of message.author
(node:3292) UnhandledPromiseRejectionWarning: TypeError: message.member.guild.hasPermission is not a function
should i remove guild ?
Yeah it should be message.member.hasPermission
You don't have a testing alt?
nah
if else if else 
guildMember.createdAt
@elder vine that returns a time, but not in the format of x hours x minutes ago
what type of bot should I make ๐ค
a unique one
a quote one
so you can be like !quote @x quote
and then is stores it in an array
Make a bot that uses discord client's computers as workers for Folding@home
lol
Make a new library
Make a universal library
Make a library for lua so we can make bots in Minecraft with the ComputerCraft mod
Hey
I tried making a reactionrole command, but when i used the event, it will give me the role even if i react with another emoji on another message
client.on("messageReactionAdd",(reaction,user)=>{
if(reaction.emoji == args[0]);
reaction.message.guild.member(user).addRole(role)```
you need to compare the IDs of reaction.message and the message that is used for reacting
i tried doing
if(reaction.emoji === args[0] && reaction.emoji.message === msg.id) ```
but it wont work
the message that u react on
reaction.emoji.message.id, not just message
I recommend storing the message of id that you react on to a database
it didnt work
if(reaction.emoji === args[0] && reaction.emoji.message.id === msg.id) ```
let msg = await message.channel.send(reactionroleembed).then(msg => msg.react(emoji))```
this is the embed send
what is the edit rate limit of the discord api?
@pallid marsh 1/0.25s if I'm right
@earnest phoenix why are you mixing async code w sync code
if(reaction.emoji !== args[0] && reaction.emoji.message.id !== msg.id)
^
TypeError: Cannot read property 'id' of undefined
wdym
oh
like an event
because i wanted to make an event to give a role
you could simply do
let msg = await message.channel.send(reactionroleembed)
msg.react(emoji)
reaction.emoji.message is undefined
probably supposed to be reaction.message.id
rather than reaction.emoji.message.id
they made a mistake then
when in doubt, read the docsโข๏ธ
yup my bad
actually just reaction
What
nvm
im trying it rn
client.on("messageReactionAdd",(reaction,user)=>{
if(reaction === emoji && reaction.message.id === msg.id)
reaction.message.guild.member(user).addRole(role)```
it wont work
no
v11
Also, if your message isn't cached, it won't send the event.
So make sure to cache the message in ready event by either fetching it, or using raw events
how can i make that event work then
how do i "cache" it
i never really used it
You can cache it by fetching the message and attaching a listener to it, or by simply not sweeping it.
can you give an example
yes
@spare goblet sleep 

#memes-and-media @languid dragon 
yeth
how does it help me
It caches the message so that messageReactionAdd event fires
else, it will not fire.
let msg = message.channel.fetchMessage(msg.id)
so is that how i define it in event ?
I suggest you learn about raw events and in extension, why the events fire, by reading thishttps://anidiots.guide/coding-guides/raw-events
alright
so is that how i define it in event ?
@earnest phoenix
let msg = message.channel.fetchMessage(msg.id)
You don't define an event
in an event
You're supposed to cache the message so discord js fires the event for that message
as it only fires that event if the message is already cached
If it's not cached it will not fire the event
Hence, you need to do it on startup
can i do somthing like
let msg = message.channel.fetchMessage(msg.id)
and then the event
such as doing on the ready event
why would message.channel be defined
message wouldn't be defined outside of the event
You would have to do client.channels.get(channelid).fetchMessage(messageid)
WHY WOULD msg be defined?
your code should look like this
const Discord = require('discord.js')
const client = new Discord.Client()
const { token } = require('./config.json') // just an example
client.on('ready', () => {
console.log('im ready')
})
// YOU SHOULD BE CACHING THE MESSAGE SOMEWHERE AROUND HERE, OR AFTER THE READY EVENT IS FIRED ABOVE ^^
client.on('messageReactionAdd', async (reaction, user) => {
// you run the function here
})
client.login(token)```
so why would msg be defined
it won't be
Hence you must do
because CLIENT IS DEFINED ALREADY ABOVE
does that make sense to you
no
What do you not understand
i tried using that
if(reaction === emoji && reaction.message.id === msg.id)
so if the reaction on the message is an emoji
and the message of the reaction is equal to the msg id
it would give a role
thats the only thing that makes sense to me
Your function was right
but
your
message
WAS NOT CACHED
so the event was not emitted
It's ok or not
if the event was not emitted, your function will not run
your function will only run if you emitted the event
Nice js formatting
use partials or raw event @earnest phoenix
client.channels.get(channelid).fetchMessage(messageid)
20 messages ago
๐
channelid*
channelid part
channelid = message.channel ?
client.channels.get(channelid)
^^^^^^ THIS returns a channel
message.channel also returns a channel
.id*
Imagine trying to correct when you're in a position where you're not able to correct or understand your own code โข๏ธ
i tried correcting myself lmao
sorry i dont know how to CACHE a message
channelid is just a snowflake
I can't help you sorry I literally already handheld you and gave you all the code yet you don't understand
all you have to do is legit fetch the message and it will cache automatically cuz that's how discordjs works
you legit just have to do client.channels.get('a channel id here').fetchMessage('a message id here')
yeah im doing it rn
the channel id of #development is 272764566411149314
you literally do client.channels.get('272764566411149314').fetchMessage('698199721709142077')
it wasnt clear for me sry D:
the 698199721709142077 is a message id I sent
idk which part where I repeated what I said over and over again didn't make sense but ok
I never fetched a message or a channel before, soooo
Yeah
what's the point of programming something you already know?
I'm just confused
does anyone know how to use glitch.com
I use it
Does it matter?
whatttttttt sorry im brain dead
i need to know how to make a reaction role command
are u serious
i was just trying to fix mine
you can see up there that i couldnt
oh
In js, is there a way to create a new class that the constructor uses async and await?
Not possible.
When my bot joins a server or we leave one, once in 4 the activity of the bot is removed and come back 30 seconds later, how do I do?
What library? Can you show the event where you join/leave a guild? I know the presence of bots "used to" (in quotes as I don't know if it still does) go away randomly.
discord.js
yes wait
let ajout = new Discord.RichEmbed()
.setDescription(`๐ J'ai rejoint un nouveau serveur:`)
.addField("๐ __Nom du serveur__", guild.name, true)
.addField("๐ __Nombre de membres__ :", guild.memberCount, true)
.addField("๐ __Nombre de salons__ :", guild.channels.size, true)
.addField("๐ __Propriรฉtaire__ :", guild.owner.user.username, true)
.addField("๐ __Rรฉgion du serveur__ :", guild.region, true)
.addField("๐ __Identifiant du serveur__ :", guild.id, true)
.setColor("GREEN");
client.channels.get("620548901258133515").send(ajout);
client.user.setActivity(`PushCount | f.help | ${client.guilds.size} serveurs.`, { type: "PLAYING" });
});
client.on("guildDelete", guild => {
let remove = new Discord.RichEmbed()
.setColor("RED")
.setTitle("๐ช J'ai รฉtรฉ retirรฉ d'un serveur:")
.addField("๐ Propriรฉtaire: ", guild.owner.user.username, true)
.addField("๐ Nom du serveur : ", guild.name, true)
.addField("๐ค Nombre de membres :", guild.memberCount, true)
.setTimestamp();
client.channels.get("620548901258133515").send(remove);
client.user.setActivity(`PushCount | f.help | ${client.guilds.size} serveurs.`,{ type: "PLAYING" });
}); ```
(how) would handling raw events for fetching uncached messages and stuff affect the bot's performance?
which discord.js version @earnest phoenix ?
He didn't even give an answer
I confused the profiles
who ghost pinged me
Ok, someone needs to make a bot where when someone ghost pings someone, it says who ghost pinged who
Any suggestions to improve this site? It's just a landing page for my bot:
https://manatee.surge.sh/
Yet another Discord bot that does all sorts of stuff.
The large area of blue doesn't seem right
Either make it smaller or make use of it
But that's just my opnion
Otherwise cool
How would I get and compare a users highest role?
what lib?
so you compare 2 users or a user's role with a different role?
I'm trying to make it so people can't ban users above or equal to their highest role
and message.member.highestRole.position() isn't working for me
position is not a function.
so would I do message.member.highestRole(position)?
and highestRole is now roles.highest
d.js 12 is so much more efficient
if you read through the code it actually makes so much more sense
but it's alot more confusing xD
not to me tbh
if you're extremely used to d.js 11.5ish its pretty confusing
For me anyway
I just don't have the .cache down, or most of the new updated things
and I didn't see the roles.highest in the changelog
basically it turns most things into managers
also
you need to do roles.highest.position iirc
send code in code blocks
message.member.cache.roles.highest.position()
message.member.roles.highest.position()
TypeError: message.member.roles.highest.position is not a function
for .cache, it would be message.guild.members.cache
or right
its not a function
message.member.roles.highest.position
yep, Thanks a ton!
I need some help, it saying that my "message.delete(5000)": it says supplied options is not an object
.-.
no
no
I mean that whoever uses the command the running command should delete
it would just be message.delete()
but it should be deleted after 5 to 10 seconds though
.-.
or is it because that I just installed the latest version of discord.js that it was deprecated?
message.delete( { timeout: 5000, reason: "Deleting command message"} )```
yes it does
I wish I stuck on the last version XD
The docs do
Red you can npm rm discord.js then npm i discord.js@11.6.4
I think thats the version
I've already updated 99% of my bot 
It wont work after intents are implemented most likely
not bot related but, whenever i compile c++ program and try to run it anywhere else
it gives me thig error:
Mingw64, flags are: g++ main.cpp -o bruh.exe
Even when i add missing dll directly it doesnt work
do you have the missing dll in the system32 directory?
it works on main pc, where program is compiled
everything is in mingw folder, not in system
you'll need the DLL inside the system directory so it can call it
you're using mingw?
yes
add the bin path of mingw to your PATH environmental variable
that was the issue for me
bruh it works on main pc
im trying to make it work on other pc that doesnt have mingw
try adding the dll to the systems dll path
then try starting it
ah
red, you're not helping
stop trying to guess the problem
yeah I do not think you know C++
whenever I compile a program and it does that I add it to the system directory, then it never throws that error
I was just trying to help from my own past mistakes
you cannot help if you do not know what the problem is
try static linking the binary, @dusky granite
i know you're not using haxe
did they change how you would use a defined var in d.js 12.1.1?
discord.js does not affect node.js syntax
if you recently updated node for it, then maybe
what were you at before?
I am not sure if any syntax was changed
okie
it's what happens when you try to sound smart
Imagine being a dick to someone whos trying to learn
soooooo cool
ikr
no, you're trying to sound smarter and more experienced in a field where you actually aren't
instead of doing that stupid shit and wasting time just directly ask about your problem
because when you try to sound smart you end up saying stuff that doesn't make sense
pardon me but it also says "bot.guilds.find" is not a function either
did the change the bot.guilds.find as well
c a c h e
they said AdD cAcHe eVeRyWhErE
because bot.guilds is a guild manager
I like 12
because you can delete the cache without problems
.-.
so how tf am I supposed to get a guild ID
when I already have the guild ID mapped
for example let someguild = bot.guilds.find(g => g.id === "id here"\
all collection methods have been moved to a .cache property
which means all functions like .get .find .reduce .map .filter etc... are now in .cache
bot.guilds.cache.find
alright .-.
the same applies to users, channels, members and guild channels
damn why discord.js do us like that it used to be simple to just find channels, members etc
then again I have been using an old damn discord.js tho
you can still use the old version if you prefer
I'm still using v11
idk how to revert versions so I'll just program all the new stuff required
I am using discord.js v12
I am trying to get the id of a certain guild which will or may not be on the same guild
let guild = bot.guilds.cache.get(args[1]);
How can I do it with broadcastEval()
I am having trouble getting my bot to launch with heroku, my code is here, https://github.com/ragnork2/Dragon-aid-bot , and its tellng me its unable to find my index.js file
can any oe teach me how to set up a repostitory
huh?
theres instructions on github @fervent osprey
man someone should pin the cache change and whenever someone asks just say to read the pin 
@heavy marsh what part of the guild do you want?
did the new cache thing change the discord embed as well
v12 has MANY changes compared to v11
one of them is RichEmbed changed to MessageEmbed
alrighty thx cause right now the documentation is killing my brain
so MessageEmbed would have options I assume right like "Rich" inside the parameter
in discord.js 12, is there a way to get the ID of the shard running?
npm run <the script>
not just npm <script>
but still
why don't you just do node index.js
what is .type?
@quartz kindle I am just trying to get the guild id as I want to make a command that will create an invite for an x guild
@obtuse wind ...
@obtuse wind that's not how you're supposed to use it ๐คฆโโ๏ธ
yeah no shit its not a function
those are the return values it can return
just do .type
it'll return one of those values
@heavy marsh broadcastEval("if(client.guilds.cache.has(id)) { create invite and return it }")
note that you will need to return the invite code as a string, you cant return a class or an object if not stringified
broadcastEval will return an array of responses form all shards in a promise, so you need to resolve the promise and then filter the array to find which element has the result
Tim your discord.js-light, does it just remove most caching and return partials?
mostly yes, but it does a few other things
cool
can someone assist me with reverting back to v11 because my "MessageEmbed" is not working with 'fields.flat" which I dont have in my damn code -.-
update node js
which version
10.9
Discord.js v12 requiring node.js v12 or higher
so what I go to node.js and download the latest version again
How many servers do you think a 4gb Raspberry PI 4 could handle, cause like, i don't really wanna buy a vps
let guild = bot.shard.broadcastEval("if(client.guilds.cache.has(args[1])) ")
@quartz kindle Can we do it like this too?
its a promise, you need to await it
let guild = await bot.shard.broadcastEval("if(client.guilds.cache.has(args[1])) ")
and just the if wont return anything
let guild = await bot.shard.broadcastEval("client.guilds.cache.has(args[1])")```
I downloaded version 13 but it still says 10.9.0 so I'm just going to shut off my bots and stop programming them because this is bullshitting my brain to the max
ahhh
@heavy marsh that will return true/false if the guild exists
ie, if you have 3 shards, it will return [false,true,false] if the guild is in the second shard
Then I want be able to do anything with that like this
let guild = await bot.shard.broadcastEval("client.guilds.cache.has(args[1])")
let invitechannels = guild.channels.cache.filter(c =>
c.permissionsFor(guild.me).has('CREATE_INSTANT_INVITE')
);
invitechannels
.random()
.createInvite(options)
.then(invite =>
message.channel.send(
`**Found Invite:**\nhttps://discord.gg/${invite.code}`
)
no, you cant do that
bot.shard.broadcastEval("if(client.guilds.cache.has(args[1])) {
let invitechannels = guild.channels.cache.filter(c =>
c.permissionsFor(guild.me).has('CREATE_INSTANT_INVITE')
);
if (invitechannels.size < 1)
return [
utils.timed_msg(
utils.cmd_fail(
`No Channels found with permissions to create Invites in!\n**ERRROR**`
),
5000
),
];
invitechannels
.random()
.createInvite(options)
.then(invite =>
message.channel.send(
`**Found Invite:**\nhttps://discord.gg/${invite.code}`
) }")```
you need to define guild, you need to pass args[1] as a variable, and there is no message
@obtuse wind yeah, you'll have to update node
I updated node
its not updating it for my goddamn bot folder
all I get is this for my MessageEmbed
how did you update?
nodejs.org I downloaded the latest version -_- unless I have to do it via proxy
are you on windows or linux?
Windows
Why not just npm i ...
did you restart your pc after installing?
Negative.
try that
node.js requires environment variables to be set on windows, which requires a restart to be properly applied
@valid gyro ok ta will have a look
idk then I'll restart my PC 3 times and see if it wants to fix itself.
node.js requires environment variables to be set on windows, which requires a restart to be properly applied
it doesn't by the way, just the underlying process that is utilising the env vars needs to be restarted
does anyone know how to get intelliJ's highlighting to detect discord.js's methods?
ok so i restarted 3 times and it still says "fields.flat" is not a function
maybe 10 times will do the trick 
I'm kidding ๐
nah kidding
what do you get when you do node -v?
that probably wont work lol
you're right cause it didnt work the first 7 times
do to your control panel and uninstall node
nvm install node.js
install windows from windows update
install git from a git pull
nvm is not a valid command
well you have to get nvm
^
hey tim
okay here I'll go to amazon and buy some NVMs
buy NVMEs
do I just download the whole git
HDD > NVME change my mind
i mean, you're not wrong in several aspects
but in many I am
ssd and hdd both thank u
@obtuse wind you were using windows, right?
yes
no nvm then
there u go
wat
in order to run node version 12 ๐
lmao
wait
Let me know how updating to Win 12 works ๐
so I just uninstalled node for no reason
what
more heroku issues! i fixed my previous issue, but now heroku just stops at the echo I have in my procfile. It doesnt launch my app at all
nah, get the nvm-windows i linked and install the version(s) you want from there, that should work 99%
when did they release win 12??
win 12?
it was a joke
o
yea lul
see, im kinda an extreme idiot
even if isnt windows 10 supposed to be updated until the universe dies
microsoft isn't moving from win10 for a while now, especially with the upcoming win10x
thats why im here asking for help on a issue thats proably pretty obvious
where tf is the nvm install
npm install is a command prompt acrion
nvm
oh nvmnd
i cannot find that in the gitr
thought that was a typo
i'm dumb
well did you install nvm
no shit I cannot find the download link
read????
Right?
so
That's the releases to what you need to download.
jonny, that's to download the whole repo
ye
oops
it's late, okay? ๐
how tf are people so incompetent to use github
when its called a readme 
maybe if you called it sudo readme ๐ค
what
what
readme is equivalent to licenses; alright. My brain is dead after seeing "fields.flat" is not a damn function
w h a t
^
no
readme is the file you read
nice message syncing.
its literally
to learn about the package
its called read me
I did
and did you download nvm
would probably help people help me if i shared the git repo
and say your problem
and after attempting to put NVM in my bot folder cough cough
Access is denied.
wait so what exactly are you doing
good
I haven't slept in 96 hours so
you guys can probably comprehend stuff better
idfk
okay I installed NVM into my node program file folder thingy
I haven't slept in 96 hours so
@obtuse wind why?
the longest a human has gone without sleep is 60 hours
quit
my problem is that im running on heroku, and it gets to the web echo in my procfile, and then never launches the bot
@valid frigate 
heroku is funny when it comes to deploying node apps
heroku is funny
@valid gyro bc you gotta use
worker: the script you wanna run
here let me restart my desktop real quick
@copper cradle did that ad it said it couldnt find the script! arggghhh
@valid frigate yeah thats the procfile in this case
oh right procfile
@valid gyro show the output
hmm
ok I restarted my PC. I'll attempt nvm now
i have no idea
at the very top of the log you sent
good question, theres no file named that and no file mentions it
hi my botum no work hi how to get channel by id in djs
keeps saying node version number is not installed
u probably have the wrong version listed in your package
now nvm isn't a thing
or no NPM
node package manager is not an internal command anymore .-.
ragnork, try to run it without the start script, just plain do node index.js
tried that too already, same result
runs fine locally with npm start
is weird part
nvm list
who you talking to
I'm talking to tis chat
ok welp I just lost about 3 years worth of Discord Bots programming just now so thats always great
how 3 years?
My bot has been existing since Early 2017.
ok and how did you lose the programming?
but you didnt lose any data?
message.guild.channels.create() iirc
yeah depends if from a message command or another event, but its [...]guild.channels.create()
MILLION, didn't lose anything but node is refusing work now; I'm kind of blaming it on my actions of installing NVM
so is NPM cause thats not working either
If you say you haven't slept in so long, just go to sleep now and look at it with a cool head again tomorrow.
nah to late I'm just deleting my applications and refunding the people who I made a bot for
If you think that is the appropriate action for one problem that you seem to not get around after 1 evening... Who am i to stop you, i guess?
Its appropriate because node and npm don't work in command prompt anymore, therefore I cannot run a bot without node thus, people who I charge 15$ (annually) for 2 years should get refunded
As i said, it doesn't work for 1 what... hour? and you want to delete everything?
are you bot hosting or developing?
he's developing
not just 1 hour its that its not allowing me to use NVM to get node version 12 (or up) in order to fix "MessageEmbed"
I am a she, and I develop for people along with hosting them too
then reinstall node?
on your own vps or
Can't u just install the new version off the site
I develop and host bots for people who pay me 15$ a year, yes Vysion. nice username btw.
and I tried that already Ragnork. again nice username
???
windows?
Its alright though, thanks for attempting to help a braindead person people. Especially you Million and Snailz
you shouldn't be hosting them
you should only develop them and then give them instructions on how to host them
https://nodejs.org/dist/v13.12.0/node-v13.12.0-x64.msi will work for reinstalling in windows
that'd save you a lot of time and headaches such as this
No zSnails, it's mainly for youtubers who don't know how discord works that well.
oof
hell some of the people who I program and host for don't even know how discord works
they should use mee6
or dyno bot
and, do you charge them monthly, yearly, or how?
or you just charge them once and that's it
Yearly
I am not money hungry or take things for granted I
just charge 15$ and thats for every year
True but then again, I don't really want money
it's not being money hungry, but valuating your own work
if I could do that I'd charge at least $30
All this is beyond the topic of this channel though. #memes-and-media
honestly, 5 - 10 dollars a month if hosting is included
if the bot is good
but thats for a bot that will only be in 1 or 2 servers
Yeah I'm sorry I should prolly move to different channels
Hi, I want my bot to read the attached picture, but it can't because of Error 403: Forbidden. Is there something I can do?
where do you get that error?
urllib with async code...
Is there another, """"approved"""" way?
aiohttp
aiohttp is async
I'll look into it, thanks
urllib is sync, so you shouldn't be using a blocking lib with non blocked code
in this case sync with async
Magic of Python
@zinc condor do you mean if it exists in a guild?
yeah
which version of d.js?
newest
v12
if(typeof(channel_exists) !== 'undefined') // If true, channel exists, else it doesn't ```
Maybe something like this
or simply if(client.channels.cache.has(channelID)) { // exists }
That would not account for uncached channels though. but then again, if you dont manually uncache channels, all guild channels should be cached
yes
would you fetch it if you uncache channels?
fetch is used to cache uncached channels yeah
if(await message.guild.channels.fetch(`${ch.id}`)) {
//code here
}```
yes, but if channel doesnt exist or is invalid, it will throw an error
oh
I guess you could do the opposite and check if the guild is the one that has the channel
if(message.guild.id == ch.guild.id) {}```
thanks
that will still only work if the channel is cached
works, just gotta check if a channel got deleted, am making a bot that deletes other bot messages in specific channels
well you would need the full channel object which you can get my fetching from the client channels
but if it was deleted it would error
guildData.channels.forEach(channel => {
let channelExists = msg.guild.channels.cache.has(channel)
if (!channelExists) {
Guilds.updateOne({ "id": msg.guild.id }, {$pull: { 'channels': channel }})
guildData = await Guilds.findOne({ "id": msg.guild.id })
}
})```
damn aiohttp is quite a lot harder to set up
you dont have to go through each channel and check if the channel exists again and again.
@zinc condor msg.guild.channels.cache.has(channel) can be done once on the guild. if its true afterwards, the channel exists in the guild, otherwise it doesn't. No need to do it inside the forEach
ah, i see
hes updating his database and removing channels that were deleted from it
still there are better ways to do that
for example, ```js
let toDelete = guildData.channels.filter(channel => !msg.guild.channels.cache.has(channel));
guildData = await Guilds.updateOne(guildid, remove toDelete)
i dont use mongo so idk the exact syntax for that
but you can probably delete a list of channels at once
that would only run that once no?
also not sure if updateOne returns the updated document or if you need to fetch it again
no it doesnt, later on i redefine guildData once the loop is finished
it will run once yes, but it will execute with all channels that are deleted
instead of deleting one by one in a loop, you get a list of deleted channels and try to delete them all at once
not actually sure you can delete multiple at once out of an array so i need to look that up
yeah not sure either, but its probably possible
lemme see
npm and node work again but its still not listing available versions on NVM
for mongo, you can define a variable as a doc and update the variable to what you want, then you update the doc to the variable
I have the following:
dbl.webhook.on('vote', vote => {
console.log('run')
client.users.fetch(vote.user).then((user) => {
client.shard.broadcastEval(`
const voteLogs = this.channels.cache.get('693204858068664491')
if (voteLogs) {
console.log(user)
voteLogs.send(${JSON.stringify({embed: new Discord.MessageEmbed()
.setAuthor('New Vote!', client.user.avatarURL())
.setDescription(`\`${user.username}#${user.discriminator}\``)
.setColor(0x2F3136)
.setTimestamp().toJSON()
})})
}
else {}
`)})
});```
It seems that brodcast eval wont read `user` from the promise. How should i go about doing this?
I'm fairly new to sharding and using brodcastEval so still getting used to how everything works
I dont know if this is your issue but you can make it `${vote.user}` to make it a string
@clever storm use a better sharding manager
you dont need to create the embed and then stringify it
Has nothing to do with sharding at all
pass the embed constructor as a string, and let the shard build it
neither did mine :3
xD
cant with the sharding manager im usin
Clearly not
Anyway, this isnt my issue it seems @quartz kindle
c0bra did you do what I suggested?
This works fine, just for some reason var from my promise
not my issue @crimson vapor
stop that dad
@quiet rampart stop
If i remove the vars it works just fine
@quiet rampart stop being useless if you aint gonna add to the conversation stay out of it
@clever storm you didnt pass the variable to your console.log
Lmao and
if it was throwing an error, it was because of that
user is not defined in the evaled code
Correvct
Tim, client.users.fetch() works regardless of shard right?
Yes
yes
so does client.channels.fetch() (if thats a thing) work
can someone explain to me how to delete a git directory
yes
not in github but git




