#development
1 messages · Page 815 of 1
I definitely see your point, but I guess many servers don't see it to be that important
I agree it is not that important, yet a few extreme users dividing up one sentence into 10 messages skew with the results enough that we'd prefer to count characters.
It would certainly not be worth it to create and host a custom bot just for this feature, if we find nothing some other features would likely have to be considered and added first
Fair enough - good luck with whatever you decide to do 👍
Its very hard for a machine to draw a line between an actual conversation and spam
Its extremely easy to trick it
Youd need something like an AI to do anything more than a few basic checks
we already considered that problem, fortunately the moderation capacity is currently high enough to check for spam. For the simple "aaaaaaaaaaaaaaaaaaaa" spam we already have a bot with web API, otherwise members could easily report to staff. But yes, to create a true automatic system to draw the line what you suggest is absolutely true
{
"prefixes":["."],
"restart": {
"guild": "",
"channel": "",
"user": ""
},
"botMasters": ["370381633305575426", "[REDACTED]"],
"latency": [50,100,39,163,192,100,75,117,108,215]
}
```Why am I getting `Unexpected end of JSON input`?
Are you sure its coming from there?
what is server.js 4th line
client.config = require("./config.json");
Is that everything your config.json has?
Yes.
Yep.
Then do console.log(fs.readFileSync("./config.json"))
Before the require
Make sure you require fs before if you dont have it already
Does anything show up in the console?
It shows <Buffer >.
i need some help to get in my bot to my server agien...
Weird, it doesn't show anything (before the first line of the error).
Then your json file is actually empty
Your glitch editor is out of sync
Or the file is not saved
Make sure the file is saved
And refresh your project
Awesome! That worked, thank you! 😄
And in v12, did client.guilds and guild.channels change to client.guilds.cache and guild.channels.cache?
what this means?
Methods that send a request to discord, such as .fetch, is the same as before
client.guilds.cache.get("guild_id").channels.cache.get("channel_id").send(`Test.`)
```So this *should* work?
But collection methods such as set,get,has,filter,map,forEach,etc were all moved to .cache
Yes
@quaint sorrel you need to disable the code grant option
In your discord developer bot settings
exports.run = async (client, message, args) => {
if (!client.config.botMasters.includes(message.author.id)) {
return;
}
await message.channel.send({embed: {
color: client.color,
title: "Restarting bot. This may take a few seconds...",
timestamp: new Date(),
footer: {
text: message.author.username,
icon_url: message.author.avatarURL
}
}});
client.config.restart.guild = message.guild.id;
client.config.restart.channel = message.channel.id;
client.config.restart.user = message.author.id;
client.fs.writeFile(`./config.json`, JSON.stringify(client.config), (err) => console.error);
client.destroy();
process.exit();
};
I have this code and for some reason it is deleting the data in config.json (which was my problem before now).
I've done it this way before and had no problems.
when you write to a file, its current data is overwritten
so make sure that the config you have in memory is up to date with the json file
Your last message is confusing. 
what is confusing about it
the config object you stored in memory may not be the exact same object that's in the json file
aka something changed between those two
you should listen for changes on the json file and read it on boot (and of course store the result of it in memory)
Okay, I fixed it.
I was using writeFile instead of writeFileSync.
Thanks though. 😄
Hey, need some help with making a bot with Java
I don't know how to install JDA
Also getting the error...
java error: release version 5 not supported
JDA?
Java wrapper for the popular chat & VOIP service: Discord https://discordapp.com - DV8FromTheWorld/JDA
This thing
For Java
Only coding language I know
@floral bloom the reason it was being deleted is that you put process.exit() outside of the writeFile callback (err => {}). That makes it immediatelly exit the process without waiting for the write to complete
which ends up with an incomplete/broken file
JDA is pretty easy to install if you use Maven
@lyric rock https://dev.to/techgirl1908/intellij-error-java-release-version-5-not-supported-376
By default, your "Project bytecode version isn't set in maven project.
It thinks that your current version is 5, so just go to "Project Settings>Build, Execution...>compiler>java compiler" and then change your bytecode version to your current java version.
the reason it was being deleted is that you put process.exit() outside of the writeFile callback (err => {}). That makes it immediatelly exit the process without waiting for the write to complete
Ah, I see.
@blissful scaffold Thanks! Now having issues with...
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.1.1_110</version>
net.dv8tion, JDA, and 4.1.1_110 are red
I use Maven
Here is a JDA maven example that you can find on the JDA discord:
https://hasteb.in/afefaqal.xml
There's a JDA discord?
yes
Can I have the link?
Thanks!
has there been any change in the Instagram API? my instagram info command not working now
after version@V12?
wdym
require("discord.js").version```
returns as your djs version
You can also just check out your package.json
Getting an error when trying to make a new command for mute.
This command well make it so that it will create a mute role when command is executed.
Code.
const usage = require("../../../utils/usage.js"); //better help-messages
const { prefix } = require("../../loaders/reader") //get prefix from botconfig
module.exports = {
config: {
name: "createmute",
aliases: ["createnospeak"],
usage: "!createmute",
description: "Make the mute role.",
permissions: "manage roles"
},
run: async (bot, message, args) => {
if (message.channel.type == "dm") return message.channel.send("This command only works in a server!");
if(!message.member.hasPermission("MANAGE_ROLES") || !message.guild.owner) return errors.noPerms(message, "MANAGE_ROLES");
if(!message.guild.me.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return errors.lack(message.channel, "MANAGE_ROLES");
let muterole = message.guild.roles.find(r => r.name === "Muted") //look to see if muted role already exists
if(!muterole) { //if not
try{
muterole = await message.guild.createRole({
name: "Muted",
color: "#514f48",
permissions: [] //create muterole name + color
});
message.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermissions(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
SEND_TTS_MESSAGES: false,
ATTACH_FILES: false,
SPEAK: false
}); //will overwrite permissiosn for each channel to make it so that the user can't speak
});
channel.message.send("Mute role was not found, so it made it. ")
} catch(e) {
console.log(e.stack); //if err log err
}
}
}
}
Error.
at Object.run (C:\Users\Cools\Downloads\DogBot\src\commands\moderating\createmute.js:37:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
ReferenceError: channel is not defined
at Object.run (C:\Users\Cools\Downloads\DogBot\src\commands\moderating\createmute.js:37:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Note, it does everything, but it dosen't message into that channel that it was executed and say "Mute role was not found, so it made it.
Isn't it supposed to be message.channel.send("text") instead of channel.message.send?
yeah, np
I want add music to my "Spanish" Bot but when i do the distpacher its says me "distpatcher is not defined" (Ik that i dont have to define it but what can i do?)
can you send your code?
on discord.js.org it says you can use const dispatcher = connection.play('/home/discord/audio.mp3'); to define it
LMAO channel.message.send() BRUH
channeling the inner message 
if(!message.member.roles..has('662466795810193428')) return; how to use in new version of discord.js (v12)?
if(!message.member.roles..has('662466795810193428')) return;how to use in new version of discord.js (v12)?
@amber geyser https://discordjs.guide/additional-info/changes-in-v12.html
here you can find all changes
no fund
wut
Hi, I was wondering if this is a bad thing to show up and how do I fix it if so?
(node:11) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
Please @ (or DM) me if you can help. Thank you so much
Possible memory leak detected. Solution given.
...
Coronavirus bot.
Post it
big bruh
I think that your bot has to be in enough servers for that to come up. But I could be wrong
@modern iron hmmm enough is how much
you need to use the topgg api
Oh cool yeah that sounds right
Btw I tried to use “emitter.serMaxListeners()” but it said emitter is not defined
can we make a command count upvote
I'm ready to start building my first discord bot
@earnest phoenix I hope that's a jokw
since you already have the bot dev role I'll assume it is
it is a joke
Attempting to make a createmodlog channel. It'll create a channel called modlog so that my bot logs everything it needs to into that channel.
My code:
const usage = require("../../../utils/usage.js"); //better help-messages
const { prefix } = require("../../loaders/reader") //get prefix from botconfig
module.exports = {
config: {
name: "createmodlog",
aliases: ["createmodlogchannel"],
usage: "!createmodlog",
description: "Make the modlog channel",
permissions: "manage roles"
},
run: async (bot, message, args) => {
if (message.channel.type == "dm") return message.channel.send("This command only works in a server!");
if(!message.member.hasPermission("MANAGE_ROLES") || !message.guild.owner) return errors.noPerms(message, "MANAGE_ROLES");
if(!message.guild.me.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return errors.lack(message.channel, "MANAGE_ROLES");
let modchannel = message.guild.channels.find(r => r.name === 'modlog' ) //look to see if muted role already exists
if(modchannel) message.channel.send("\ FAILED! Reason: Modlog is already a channel!")
if(!modchannel) {
message.channel.send("Making channel currently. It wont have permissions meaning everyone can view it!")
guild.createChannel(name, "modlog");
}
}
}
Error:
at Object.run (C:\Users\Cools\Downloads\DogBot\src\commands\moderating\createchannel.js:22:13)
at module.exports (C:\Users\Cools\Downloads\DogBot\events\guild\message.js:38:21)
at Client.emit (events.js:219:5)
at MessageCreateHandler.handle (C:\Users\Cools\Downloads\DogBot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\Cools\Downloads\DogBot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
at WebSocketConnection.onPacket (C:\Users\Cools\Downloads\DogBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
at WebSocketConnection.onMessage (C:\Users\Cools\Downloads\DogBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
at WebSocket.onMessage (C:\Users\Cools\Downloads\DogBot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:219:5)
at Receiver.receiverOnMessage (C:\Users\Cools\Downloads\DogBot\node_modules\ws\lib\websocket.js:789:20)
(node:5968) 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: 1)
(node:5968) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
Lol maybe try making it message.guild how it is in the rest of the command 🤷🏻♂️
Hey, I need help
const Discord = require("discord.js");
module.exports = async (client, message) => {
if(message.author.bot) return;
if(message.author.id == client.user.id) return;
if(message.channel.name.includes("staff")) return;
let logBTN = client.db.setguild.get(message.guild.id, "loggingBTN");
if(logBTN !== true) return;
let chn = client.db.setguild.get(message.guild.id, "loggingCHN");
if(chn == null) return;
let embed = new Discord.RichEmbed()
.setTitle(`A message was deleted`)
.setDescription(`▫️Author: \`${message.author.tag}\`
▫️ Content: \`${message.content.length >= 1 ? message.content.substring(0,960) : '-' }\`
▫️ Message ID: \`${message.id}\`
▫️ Channel: <#${message.channel.id}>`)
.setTimestamp()
.setColor(client.scolor)
.setFooter(`${client.user.username}#${client.user.discriminator}`, client.user.avatarURL)
let c = message.guild.channels.get(chn);
c.send({embed});
};
``` my messageDelete.js
event
Whenever a user delete's a embed message it returns -
Is there any way I could get like the message is deleted is a embed?
@soft flare self host your bot
i did...
i need a full model of Embed
its gives me erroe Token...
And how can i make a file.js to run exemple server.js is running by package.json how can i make more?
dm me for Suggestion or Awnser
@soft flare i can't see anything
i mean
if people are on pc
they can always click "open original"
i wasnt talking about you
how old are u
dont use glitch is one but ik thats not very helpful
too
;p
eh im just very against free services. but idk anything about js ;p
glitch have discord.js
wut
you can literally install discord.js on any vps so-
i would never run my bot on glitch or any other free services
^
i hosted my bot 24/7
until it actually gets people using it
i prefer heroku for hosting and if you have a github account you can have 200$ credits for spending on heroku with student program
its set on private
ah
i mean i just use my laptop
a rdp is what i use to run my bot on can edit my files any where i go 😏
i mean
i just remote into said laptop
or i can just push to my github repo and restart my bot so
i dont need to be dragging files to vps and then run it again
just tell me how can i run any js...
nadeko again i dont either
i literally push to /master and restart my bot with %die
once i finish my bot auto restarts
and boom its running
xD
lol
vps is slow sometimes as well
ok nobody is useful
ok dont insult people cuz no one can help you atm
@soft flare get a vps if u want to run your bot
my bot is running non stop
or hell. a raspberry pi
lol
what
i run a bot on it
not ansura
but a private bot
what u run your bot on?
me?
yes
ansura and a self-hosted nadeko run on a laptop
kaede (private) runs on a rpi
oh
sometimes some of those vps will delete your file then u have to start all over
i have kaede set to run as a service and the rpi to go into usb otg so i can actually just plug the pi into my laptop, copy files, and plug it back into its power supply
laptop running bots also acts as a router for my pi cuz uni wifi is dumb
(wpa2 enterprise - raspbian doesnt like that)
lol
im just happy cuz finally i made by bot running
good
glad i dont have to run mine on pc and have it running 24/7
i mean its a spare laptop
my old one
before i upgraded
yh
just a baby i5 dual core
what i realize some of the bots here doesnt show the owner in serverinfo like it says undefined samething with my bot
-bots @earnest phoenix
some bots in here shows it
cry actually found an endpoint to tell if a user is deleted
and i did to make him to put a status
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
-bots @soft flare
@earnest phoenix does your bot show owner on serverinfo?
this will 404 we think when passed an ID of a deleted user
and i dont have a server info command
oh
not yet
im trying to not add features that arent handy and aren't related to gaming
yh
like it isnt gonna have moderation commands
but it'll have profile lookups for as many platforms as i can get an api key for
if the owners account is deleted why some bots show it and some doesnt kinda weird
dunno
could also be the owner isnt cached?
depending on the lib?
nah
i tried it with a discord.js bot showed the owners name and tag but mines doesnt do that says user undefined
again, cache
or you messed something up
not really it works in other servers good
let me show u in test 2 channel
then imma blame it not being cached for one reason or another
hmm
bot.on('guildMemberAdd',member =>{
const channel = member.guild.channels.find(channel=> channel.name === "<channelname>");
if(!channel) return
channel.send(`<@${member.id}> Welcome to our server`)
});```
If any guild don't wanna set it then they will kick the bot
u can also do
yes
${member}
I wanna set it for specific Channels
.
A person just told me that he uses quick.db for that
@finite bough Fix
But he didn't tell me how to do it
K eval guilds.size

@finite bough This not for me
This is very simple version for @charred jetty
.find
if u r trying to give out a code
With djs v11, I think this is the problem
spoon feeding is not allowed
<#channelid> @gritty frost
Oh
u can also use .get
but not much of a difference
or fetch
or commit delete project
lnao
@tight plinth It's very old one with bugs
I think **** I don't know 8 or
nop my F** key
can some boody help me with my he does not sending msg
`bot.on('message', msg=>{
let args = msg.content.substring(PREFIX.length).split (" "); switch(args[0]){ case "ping": message.channel.sendMessage('pong!') break; } })`
use message.channel.send instead
msg.channel.send on your case
you had message, which is not defined
i want to work on my weather command but i'm too lazy to wake up
wtf
tf
sendMessage is deprecated
discord.js version?
Done
done?
Bun
12
11
https://discordjs.guide/additional-info/changes-in-v12.html @quaint sorrel
How do I set up my Discord bot in a DigitalOcean VPS? I am moving from Glitch to an actual VPS.
I am using discord.js v12
yes ofc
how?
download the files on mobile
thanks
does anyone know how to make this show the owner of the server?
Show code
message.guild.fetchMember(message.guild.ownerID).then(m => m.user.username)
message.guild.owner.user.username
?
Owner not cached
Oliy is online
Just d.js things
Should be cached
not working
That's why they were doing it right
Fetching owner
You'll need to await it though
Await the fetch then get the username
message.guild.fetchMember(message.guild.ownerID).then(m => m.user.username)
that is my code
Try (await message.guild.fetchMember(message.guild.ownerID)).user.username

They are on v11 it looks like
@earnest phoenix JS yea?
I have it as
let owner = message.guild.owner
if(owner) owner = owner.user.tag
.addField("Owner", owner) @earnest phoenix
o w n e r
let me try that
o w n e r
o w n e r
use ternary operator
o w n e r
Aight let's not
@zenith terrace didnt work
How big is the server ur trying?
this server's size
what's the problem you're having?
Cant find the owner
this server
message.guild.fetchMember(message.guild.ownerID).then(m => m.user.username),
thats what i have
oh damn 12.0.2 is out
Changes?
@pale vessel
@earnest phoenix
Sometimes the bigger the server sometimes the bot cannot get the serverinfo. I had issues with it on this server as well
But it worked on smaller servers
Version 12.0.2 has been released!
Bug Fixes:
- APIRequest: only use form data when actually sending files
- Guild: resolve role id and call existing handler
- MessageEmbed: skip validation of fields when inside a message
- VoiceChannel: adapt #manageable to check for CONNECT
Performance Improvements:
- VoiceConnection: skip redundant volume transformer on join
The full (read as: same) changelog is available on GitHub: https://github.com/discordjs/discord.js/releases/tag/12.0.2
Nothing interedto'c
Interesting
please
@zenith terrace can u show me your bot serverinfo in testing 1
Testing 2 since its freed up
yh
have you tried fetching the owner using client.fetchUser(guild.ownerID)?
fetchUser is so old..
he's on 11
message.guild.fetchMember(message.guild.owner, true)
@torn nebula samething
already tries that sameting
message.guild.ownerID
didnt work
does fetchmember accept a member object?
Again it is gonna be hard to find the owner of here since its a big server
^
what is the problem here?
my bot serverinfo cant find the owner for here
Have you tried the bot on a smaller server?
yes
message.guild.fetchMember(message.guild
.ownerID)
it's 11 right @earnest phoenix ? or are you using 12 ?
Ye
kk
message.guild.fetchMember(message.guild
.ownerID)
@earnest phoenix try this
v11
do you have fetchAllMembers true?
YES
🤦

@earnest phoenix try this
Just try this
message.guild.fetchMember(message.guild
.ownerID)
anyone know this error ?
(node:14811) 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: 645)
(node:14811) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 162.....
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
anyone know this error ?
(node:14811) 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: 645) (node:14811) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 162..... at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
async without function?
missing }?
missing }?
@regal saddle i dont think so
ok so, i wanted to get the .joinedAt (GuildMember) of the user, i fetch a user with .getUser, but i don't know how to get the GuildMember propriety on the user
@summer torrent i did still not showing anything
async without function?
@regal saddle maybe this one hmm
can i see your code?
i dont know which code is wrong
give the full stacktrace
You don't have a catch but it looks like a connection timed out causing it to error
honestly not much to go off from that
give the full stacktrace
@west raptor i cant sorry
why
.catch(); is missing...But where?
if you gave the full error/stacktrace we could figure out where in the code there's an issue

async function without a catch block, or by rejecting a promise which was not handled with .catch().
the full stracktrace would say what line is at fault or where it's hanging
that's your issue
bruh
it's timing out while connecting to that TCP connection
and you don't have any catch so it just errors since it fails
i have shards
i was add so much try catch
@manic light reload panel
maybe i miss something
@manic light reload panel
@cunning glen ye i know but its coming all time


@manic light try generating a new token, maybe check how many requests your bot is making to the discord api
cuz of this sh*t
because you can get blacklisted temporarily if you make too many causing your bot to essentially die as it fails to connect
okey
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
as some other information as well that might be useful for you aswell
huh?
Embeds haven't changed for ages?
used to be RichEmbed now it's MessageEmbed
https://discord.js.org/#/docs/main/master/class/MessageEmbed
Changed from RichEmbed to MessageEmbed
https://discordjs.guide/additional-info/changes-in-v12.html for the full change
oh ok, my bad
Does anyone know how to use Termius SSH Client to connect to their Linux VPS? Because I can’t type anything in the teminal.
the keyboard is already up but it just wont record my inputs
Why my bot not added tell me all developer
<@&304313580025544704>
do you have a decent connection to the server
@earnest phoenix you gotta wait
it’s just a ssh stream so if your connection is bad it will probably lag or not load at all
Ok
lol, it's only been 4 days
-atmods
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
Error
My bot automatically restarted
and started installation and shows that error
Alright, I've been trying to get a bot up and running (first time) and ive hit a brick wall so very hard that even now, half an hour after giving up, my heads still spinning. Im following the https://www.sitepoint.com/discord-bot-node-js/ guide for how to get a bot online, however im afraid that even the most basic of coding listed here is anathema to me. I use VSCode (the latest version) and Node.js. I copied the repository locally, opened it in VSCode, ran npm install dotenv as well as npm install discord.js
the next step says "Lastly, to complete the installation, create a .env file in the root of the project. Add one environment variable called TOKEN to the file like this: TOKEN=my-unique-bot-token wherein lies my problem. I dont know where the Root is, nor do I know hoe to create a .env file. On top of that, I am unsure what an Enviromental Variable is. I am more than willing to provide any screenshots or more in depth explination of someone is willing to help me figure out whats wrong. If someone does for whatever reason feel like helping, please DM me or @ me in this channel. Thank you in advance,
-Ikit Cawl
The root is quite literally the root directory, the main directory of the project, where everything originates from, to create an env file you can create a new file in vsc and give it a custom extension of .env
Do i name it something?
static async verify(channel, user, time = 30000) {
channel.awaitMessages(
m =>
m.author.id == user.id &&
yesno.includes(m.first().content.toLowerCase()), {
time: 30000,
max: 1,
errors: ["time"]
})
.then(collection => {
let msg = collection.first().content
? collection.first().content.toLowerCase()
: null;
if (yes.includes(msg)) return true;
if (no.includes(msg)) return false;
})
.catch(err => {
console.log(err)
return false;
})```
m.first() is making problem
Im gonna guess i just have to name it .env
as for an Enviromental Variable, is that just imputting a line of code saying TOKEN=my-unique-bot-token
?
i have this nagging feeling that my bot token goes in place of "my-unique-bot-token" however the way its worded makes me think otherwise, since it dosent contain parentheses. Perhaps it dosent need them?
E
perhaps i should start over with the pinned Discord Bot guide...
it seems like i was misunderstandsing the use for the pinned bot guide
Does anyone know of a bot testing framework for JS?
Like Mocha or Jasmine, but for bots
Yes?
Why can't you just call .react() twice?
can anyone make sense of this? the token provided is the one i copied of my dev page so it shouldnt be invalid. or at least i dont think it should be?
what's the new problem?
or is it the same error?
^
it would've said missing module instead
ye
nice
holy christ on a cheeze-it it worked

oh damn

its 7am

thank y'all so much
Hey, can someone help me ? It's a discord.js module bug, what should I do ? I already tried to uninstall reinstall
I will check @summer torrent
v12 requires node v12 too
But I never touch to version and it worked perfectly before
Stable was just updated to v12
How can I check ? I just have this
8.11
I'm bad sorry 😭
yeah
Oh
update
Okay
you need to update to node.js 12
Okay I will
thanks 😁
yo i’m looking for a discord bot to be developed i don’t think it will be insanely hard i just have no clue what i’m doing. DM me for more info
who can tell me a model of Embed Message for Glitch.com
maybe your doing wrong
😐 I build more than 100
not gonna 
its MessageEmbed now
and unexpected token is because your bracket/whatever pairs are fucked up
and how i am suppose to fix?
???
even this will not gonna work
mehmmh
how about this **const exampleEmbed = new Discord.RichEmbed()
.setTitle('Some title')
.attachFiles(['../assets/discordjs.png'])
.setImage('attachment://discordjs.png');
channel.send(exampleEmbed);**
?
good
url must be valid
i will add a image in assets
and post it in there right?
the pairs error still there
how can i fix this...
})
client.login
maybe depends on code
oh?
if it's a static image you can just use a service like imgur to upload it saves needing to upload to discord each time
i deleted it accidentally...
ok no more error
let test
btw on glitch.com how can i run another js file?
make sure it's reload and online back
you know packaxe.json make server.js to run
and i want to make another one
i restarted
New File Button
no awnser
ye ?
i created it already
its called moderator.js
you can join the server and take a look
const file = require(file); on the main file.
server.js or packaxe.json?
@soft flare i suggest you learn basic javascript before making a bot
learn all of js. not just some.
@soft flare no
i am trying to make my bot play audio the bot joins the VC and discord shows that its playing the audio but it isn't
if (msg.member.voiceChannel) {
msg.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
msg.reply('I have successfully connected to the channel!');
const dispatcher = connection.playFile('K:/audios/audio.mp3');
})
.catch(console.log);
} else {
msg.reply('You need to join a voice channel first!');
}
Hello i have a probleme with my discord bot (node:13) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function at Function.normalizeFields (/home/container/node_modules/discord.js/src/structures/MessageEmbed.js:433:8) at MessageEmbed.addFields (/home/container/node_modules/discord.js/src/structures/MessageEmbed.js:249:42) at MessageEmbed.addField (/home/container/node_modules/discord.js/src/structures/MessageEmbed.js:240:17) at Object.run (/home/container/commands/help.js:15:14) at process._tickCallback (internal/process/next_tick.js:68:7) (node:13) 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: 1) (node:13) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
fields.flat not a thing ig
@earnest phoenix fields.flat is not a function
you can make a function by doing
function fields.flat() {
}
and put your code inside that
in my help.js
in the file you have "fields.flat" in
Were ? ```const {
MessageEmbed
} = require('discord.js');
module.exports = {
name: 'help',
category: 'bot',
async run(client, message) {
var commands = client.commands;
var commandList = new MessageEmbed()
.setAuthor(message.author.username, await message.author.displayAvatarURL(), client.opt.url)
.setDescription(Voici la liste de mes commandes | prefix: ${client.opt.prefix})
.setThumbnail(await client.user.displayAvatarURL())
.setColor(client.opt.color)
.addField('Bot', '' + commands.filter(e => e.category === 'bot').map(c => c.name).join(', ', true) + '')
.addField('Music', '' + commands.filter(e => e.category === 'music').map(c => c.name).join(', ', true) + '')
message.channel.send({
embed: commandList
}).catch(console.error);
}
}```
This ?
const {
MessageEmbed
} = require('discord.js');
function fields.flat() {
}
module.exports = {
name: 'help',
category: 'bot',
async run(client, message) {
var commands = client.commands;
var commandList = new MessageEmbed()
.setAuthor(message.author.username, await message.author.displayAvatarURL(), client.opt.url)
.setDescription(`Voici la liste de mes commandes | prefix: ${client.opt.prefix}`)
.setThumbnail(await client.user.displayAvatarURL())
.setColor(client.opt.color)
.addField('Bot', '`' + commands.filter(e => e.category === 'bot').map(c => c.name).join('`, `', true) + '`')
.addField('Music', '`' + commands.filter(e => e.category === 'music').map(c => c.name).join('`, `', true) + '`')
message.channel.send({
embed: commandList
}).catch(console.error);
}
}```
yes
But my bot crash :/
Ok
it seems fine with me
if you're asking, where should I put a function, then you should question your knowledge as a dev
I start in dev
to trigger the function do fields.flat()
shouldn't it be run: async (client, message) { ?
no
i meant the fact that it's an object. you can't put a function out of nowhere
It should be async run: (client, message)
why are you salty
well yes
@elder garnet Have a solution ?
async run: (client, message) {
@earnest phoenix you need to put something in the function so whenever you type "fields.flat()" it runs the script inside that function
i put all help.js in function .
?
is this about the fields.flat thing
yeah
didn't scroll
lol
i'm rarted
@earnest phoenix I'm in serveur but i didn't do this
@earnest phoenix i guess you need to update node from https://nodejs.org/en/
discordjs now requires a minimum of node 12 iirc
yes
you need to update

you need to update node.js for it to work
Mon bot est sur une machine
bruh moment #1
that is french
Oh sorry
posting ur bot on ur machine Is a bad idea
I don't have to update node js on the machine
im hosting my bot on heroku.com and its good ngl
But my bot is hosting in this https://pterodactyl.io/
The open-source server management solution.
Oh no it's to long 
what is so long
@earnest phoenix you should be able to use the terminal they have to update nodejs if I'm not mistaken. if not then that's my bad ^-^
How?
Google is your friend for that Tapaque.
what is messageSent[1]
message that is split by spaces maybe
It's because you are checking if it isn't tail but your sending tail so it's false
@gritty frost why?
google it @gritty frost
wdym files missing 
For all those people who find it more convenient to bother you with their question rather than search it for themselves.
🥺
this is my code
const { RichEmbed } = require("discord.js");
const { getMember } = require("../../functions.js");
module.exports = {
name: "dm",
aliases: ["message"],
category: "fun",
description: "dms a user :O",
usage: "[mention | id | username]",
run: async (client, message, args) => {
if (!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send(`${message.author}You don't have permission! **You need BAN_MEMBERS perms for this**`);
let user = getMember(message, args[0]);
if (!user) {
message.chanel.send("give me a mention/userid to mesasge");
}
const embed = new RichEmbed()
.setColor("RANDOM")
.setDescription(args.slice(1).join(" "));
try {
user.send(embed).then(message.react("✅")).catch(() => {})
}
}
}
}
and i get this error
missing catch(e) {} after try { user.send(embed) blablabla }
example of using try and catch
console.log("successfull");
} catch(e) {
console.log(e.stack);
}```
basic js
i have a music bot that doesnt play music from youtube. What should i do?
@earnest phoenix what music do you uze
youtube music
What library do you use
discord.js in Glitch
yes
Ok, do you have a YouTube API key?
no
You need one
where can i get it?
@golden condor ok now i have api key, where should i put?
nvm
Could Someone Help me? It's been hours i try to fix that
what is your djs version
discord.js ?
Yes
12.0.2
Oh i din't know thanks !
Can anyone help me with a super simple discord bot that writes and reads to a JSON file?
Exception ignored when trying to write to the signal wakeup fd:
BlockingIOError: [Errno 11] Resource temporarily unavailable
My bot becomes inactive after a while
How can this be solved?
editedmessage = message.content.slice(prefix.length);
client.msgs [message.author.username] = {
T6PB: "Yes",
}
fs.appendFile ("./msgs.json", JSON.stringify (client.msgs, null , 4), err => {
if (err) throw err;
message.reply ("I have stored that you can" + editedmessage);
});
}
if (message.content == (prefix + " craft T6 plate armor")) {
editedmessage = message.content.slice(prefix.length);
client.msgs [message.author.username] = {
T6PA: "Yes",
}
fs.appendFile ("./msgs.json", JSON.stringify (client.msgs, null , 4), err => {
if (err) throw err;
message.reply ("I have stored that you can" + editedmessage);
});
}```
I have this code to write to a JSON file
"BigTibbies": {
"T6PA": "Yes"
}
}{
"BigTibbies": {
"T6PB": "Yes"
}
}```
It outputs like that
How can i get the T6PB under the first "BigTibbies" instead of creating a new one?
You cant use appendFile with json
It breaks the json structure and makes it unusable
Also, doing something = { etc:etc } will replace the entire object, since youre defining a new one from scratch
To add to an existing object you do something.etc = etc
You just need to check if the object exists before adding
can u help me i want to do my music bot but when i try to define song its says me error
const serverQueue = queue.get(message.guild.id);
if (!serverQueue) {
}else {
serverQueue.songs.push(song);
console.log(serverQueue.songs);
return message.channel.send(`${song.title} has been added to the queue!`);
}
"song is not defined"
Well did you define song?
Show where you define song
i just dont defined idk how to srry if i lie XD
Youre trying to add a piece of data called "song" to the queue
But what is "song"? Where does it come from? What does it contain?
Your code doesnt magically know that
Ik
You need to tell is exactly what to do
So where does song come from?
Mhh from my library?...
In your code, do you have let song = something anywhere?
You need to tell your code what the value of song is supposed to be
${client.guilds.size}
${client.users.size}
After i updated discord.js to v12 now my bot say undefined
Sorry for disturbing your time. You the guys who is reading this.
Thanks for taking your time for my problems.
Guys what cmd do you suggest me to do?
@limber saddle there is a guide on updating v11 to v12, check it out
^
Guys what cmd do you suggest me to do? (2)
What is the bot's main purpose?
everything
wdym by everything
Why'd you ping me D:
I was asking BG what kind of bot it is so I could suggest a command.
wrong channel
:p
of moderation i only did kick, ban and clear
Maybe for moderation do lockdown-channel?
ur wish
i just fucking got pinged 5 times in 10 minutes in the same fucking server
i wanna die
Maybe for moderation do lockdown-channel?
@earnest phoenix idk
should I?
Im here to ask suggestions :p
Your choice
Look at what other bots are doing
And see if you like anything
Or just wait until you come up with something
oki
Or just wait until you come up with something
@quartz kindle the next eternity
heeeelp meee
@plucky jewel ur problem pls
Show error show code explain
no
error:
No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
no)))))))))) i am silly


i am not understand
I can’t understand how to put this language so that it understands
you what
which language do you speak?
russian)
omg
have you selected a buildpack on heroku's dashboard?
oh
wait
Why does this happen when using discord.js and trying to get the uptime of my bot? (Note: I am using a VPS and a Command Handler)
module.exports = {
name: "uptime",
desc: "Returns bot uptime from start",
usage: "",
execute: async (message, args) => {
let totalSeconds = (client.uptime / 1000);
let days = Math.floor(totalSeconds / 86400);
let hours = Math.floor(totalSeconds / 3600);
totalSeconds %= 3600;
let minutes = Math.floor(totalSeconds / 60);
let seconds = totalSeconds % 60;
let uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;
message.channel.send(uptime)
}};
integer division maybe?
^?
new error..
Js doesnt differentiate ints and floats
hi
@earnest phoenix youd problem is youre using the wrong client
with botss
eris
Isn't it // for int div
The wrong client?
Yes
Hm.
Let me recheck my globals...
ik number, but not hex
@digital ibex how tf do you know number colors?
wot
oh
like, do you mean integers?
like
You need to either get it from the message, or send it in the execute function
Without ()
все, мой недоангл урвался
message.channel.guild.roles.find((r) => r.name === 'some-role-name').color
returns a number
буду общаться на русском
bruh
ah, just convert it to rgb
They are going to talk in Russian
Does eris not have .hexColor?
Google Translate time
not that im aware
shiro translate time
Большинство людей здесь говорят только по-английски @plucky jewel
Then you need to convert it yourself
Вы находитесь на английском сервере
Google how to convert decimal to hex
not that im aware
@digital ibex probably that method returns an integer
так нету же блин такого сервера ток на русском @unique nimbus
get the bytes of it:
0xFF0000FF -> red
0xFF00FF00 -> green
0xFFFF0000 -> blue
ok uh
Тогда используйте переводчик, чтобы попытаться поговорить с нами
shift the bytes of the value to get each channel
how would i get the a users highest role and get the colour of that?
get the role array -> first
Sorry for the random Russian
Try this color.toString(16)
lol




