#development
1 messages · Page 944 of 1
ok
ok
or just create a logs channel and get the id and send it to the log channel
i actually do both
so i get personally dm'd errors, and it shows up on my dev server
though im not sure how it would work for multiple clusters
for my bot
try{
//code
}catch(e){
Client.channels.get("701387785789112331").send(e);
}
Can do this on the index file ??
try it anndsee
if Client is defined yes
oh shit
hi
bye
i mean
how to put a Vote key
?
wut
what is your "Vote key"
you mean the dblapi.js token ?
no
Vote Button?
once your bot is submitted, that vote button will appear
submitted and approved that is
U
ok
Thc
thx
until then, you wont be able to interact with dbls api
can someone help me i have a problem with this error :
node:27059) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
limit: Value "NaN" is not int.
at RequestHandler.execute (/rbd/pnpm-volume/dd9236b0-4429-4b50-9eea-eaeca220241e/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:27059) 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:27059) [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.
show me ur code
pls
const { Client, Collection } = require("discord.js");
const { token } = require("./botconfig.json");
const bot = new Client();
const color = require("./color.json");
try {
["aliases", "commands"].forEach(x => bot[x] = new Collection());
["console", "command", "event"].forEach(x => require(`./handlers/${x}`)(bot));
} catch (e) {
let embed = new RichEmbed()
.setColor(color.red_dark)
.setTitle(":x: Error!")
.setDescription(e)
.setFooter(bot.user.username, bot.user.displayAvatarURL);
bot.channels.get("701387785789112331").send(embed);
}
bot.login(token);
if (msg.content.startsWith("rn! purge")) {
try {
var limit = Number((msg.content + " ").slice(6, -1));
if (limit > 99) {
msg.channel.send("Limit must be less than or equal to 99")
} else if (limit <= 0) {
msg.channel.send("Limit must be greater than zero")
} else {
msg.channel.messages.fetch({ limit: limit + 1}).then(messages => {
msg.channel.bulkDelete(messages
)});
}
} catch (e) {
msg.channel.send(e.toString())
}
};
here
ahm why it not sending the err
Glitch?
yes
Project Name
Test bot
😄
?
Bruh
i still need help ;-;
@earnest phoenix richembed was removed
lol
discord.js( <-- gay) removed it ;-;
bot how can i keep it open 7/24
?
buy glitch premium
limit: Value "NaN" is not int.
where did u hosted ur bot
yes
@earnest phoenix get a vps
im hosting on glitch
use UptimeBot
doing
then ?
how?
somehow this is not a number var limit = Number((msg.content + " ").slice(6, -1));
@earnest phoenix how?
@earnest phoenix google for vps providers
GET A VPS
cuz it is a array
somehow this is not a number var limit = Number((msg.content + " ").slice(6, -1));
@earnest phoenix Cuz it is a ARRAY
i still have this error and idk how to fix
node:27059) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
limit: Value "NaN" is not int.
at RequestHandler.execute (/rbd/pnpm-volume/dd9236b0-4429-4b50-9eea-eaeca220241e/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:27059) 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:27059) [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.
;-;
maybe
@earnest phoenix try var newLimit = limit[0]
okay
msg.channel.messages.fetch({ limit: newLimit + 1}).then(messages => {
ngl
wut
?
@earnest phoenix ??
@earnest phoenix yall there ??
oof wait u python
@earnest phoenix use uptimerobot or freshping
@earnest phoenix use uptimerobot or freshping
@lusty imp bad idea
why
use vps
node:27540) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
limit: Value "NaN" is not int.
at RequestHandler.execute (/rbd/pnpm-volume/dd9236b0-4429-4b50-9eea-eaeca220241e/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:27540) 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:27540) [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
;-;
. . . .
didnt work
i know but it's not free🙃
if you parseint, and its not a number, it returns NaN
i know but it's not free🙃
@lusty imp you wont anything with high quality hosting thats free
better to pay
ye i know
xD
it'll try to parse it so if you put "11a" it could work
@lusty imp Heroku ??
@earnest phoenix can you send over the code where you have the issue on?
@earnest phoenix yeah
exactly there you have it
i dont see it
var limit = Number((msg.content + " ").slice(6, -1));
var limit = Number((msg.content + " ").slice(6, -1));
yes
you can just... debug to find your issue
i said to use limit[0]
just inspect your variables
but maybe not working
@earnest phoenix what is the content you are trying to parse to number
wdym
just get the size of the array

lol
@
@earnest phoenix how u know so much about js but u py
wtf
i dont even py

wut
isnt .slice for arrays?
are they trying to get the number from the rn! purge command?
a friend coded this code for me, its not working anymore
then ask your friend
that does not matter lol
nono
its pure js
how does
(msg.content + " ").slice(6, -1)
not work = wrong discord.js version
yes
ok, im confused
because it worked a yesterday
did your friend not explain what it does?
unless msg.content is undefiend or something
and i didnt update
noo
👀
:))
trolling?
nah
lol but if i do that
the rest of my 1k code wont work anymore
xd
lol
ye me 2, if i switch to v12. I have start from nothing
yep
How do you make the bot profile image hover like this with css?
@earnest phoenix can you debug your program? add a breakpoint to that Number() and check the outputs, are you getting what you want?
i mean not just number()
google css animations @deft condor
No, no number()
just (msg.content + " ").slice(6, -1)
i'm not
ur pfp is mad
so
nvm
lol
is it not that easy to parse the arguments in js? in java i simply split the messages with the spaces and just go on like that
well, idk the whole program of his
they have this weird limit[i]
so i cant say for sure what msg.content is
ah nvm
yea he trying to do it the weird way
msg.content.split(" ")
yeah
then just use msg[1] msg [2] etc
its way easier
i have to admit i did that too back then with just substringing, but that was pretty much pain in the ass
const args = message.content.slice(prefix.length).split(/ +/);
is the much better one.
you mean \s+?
what does that do?
any whitespace character
wtf
?
well thats the keyboards fault then 
idk i just used the one in the docs
bot-img img {
width: 100px;
height: 100px;
position: relative;
animation-name: example;
animation-duration: 2s;
animation-direction: reverse;
animation-iteration-count: 30;
}
@keyframes example {
60% {left:0px; top:0px;}
75% {left:0px; top:20px;}
100% {left:0px; top:0px;}
}
it works
but doesn’t work on dbl
I made my bot on mobile with glitch, how can I keep my bot online 24/7?
uptimerobot
share project URL?
uh
let me try
I’ll be bk
there’s no URL like that
the invite others to edit one?
No
Live app url
aa ty
I tried to make my bot profile image hover up and down but it didn’t work
bot-img img {
width: 100px;
height: 100px;
position: relative;
animation-name: example;
animation-duration: 2s;
animation-direction: reverse;
animation-iteration-count: 30;
}
@keyframes example {
60% {left:0px; top:0px;}
75% {left:0px; top:20px;}
100% {left:0px; top:0px;}
}
http
Friendly name can be anything right
Yes
paste the live app url
And set it to 5 minutes
Wait 5 min and see if the bot is online
@errant veldt
@earnest phoenix tysm it works great now


What can we do to make the music quality good? - discord.js v12
Except the internet connection
imma assume a bot changing the color of a role pretty often is api abuse
install some native modules that d.js recommend
imma assume a bot changing the color of a role pretty often is api abuse
@earnest phoenix aka rainbow roles
it's on their documentation
ah so yes
Its against Discord TOS
good thing i looked into it first xd
@pale vessel - I did but sometimes the music lags or its stops playing for like 2-3 s
Is it the internet connections
Or can something be done to overcome this issue
If you're using a google's VPS I doubt that the internet speed is the problem
if you're using glitch or heroku you shouldn't be asking
and if you're selfhosting, dont even ask
I do not use google's vpn
vps
if you're using glitch or heroku you shouldn't be asking
No
and if you're selfhosting, dont even ask
Nope
ah there we go
i have a question
No lol - I use a vpn
bruh
??
i have a question
@earnest phoenix yas?
No lol - I use a vpn
@heavy marsh he using a vpn?
lmao
vps*
by bad
my*
So with out the internet connection there is nothing else ...
Cause I use @discordjs/opus
otherwise you whuh
what
since when is it deprecated
it works fine tho
idk v12
just found out about it recently when upgrading my modules, idek
bruh
Hey. I have a question.
Bots can differentiate a normal message / an invitation to join a game ?
Is there a way ?
what do you mean
there could be embeds
maybe you can check for them
or basically check if there is at least content/attachment
k
by the way, never mind because game invites can have content too
discord allows you to add if you want
what lang
Ibut
don't say anything
I just want to know the lang
not the library
now
what lang
node is Javascript 
ok same thing
no lol
if node is JavaScript it’s the same
cause I just said
Node
which means java script
node is server side javascript
Ohh
node.js !== vanilla javascript && deno !== node.js && deno !== vanilla js

I tried to make my bot profile image hover up and down but it didn’t work
bot-img img {
width: 100px;
height: 100px;
position: relative;
animation-name: example;
animation-duration: 2s;
animation-direction: reverse;
animation-iteration-count: 30;
}
@keyframes example {
60% {left:0px; top:0px;}
75% {left:0px; top:20px;}
100% {left:0px; top:0px;}
}
yeah eris is lit
i have no problem with it
i need it for my custom bot's lockdown command
I tried to make my bot profile image hover up and down but it didn’t work
bot-img img {
width: 100px;
height: 100px;
position: relative;
animation-name: example;
animation-duration: 2s;
animation-direction: reverse;
animation-iteration-count: 30;
}@keyframes example {
60% {left:0px; top:0px;}
75% {left:0px; top:20px;}
100% {left:0px; top:0px;}
}
@deft condor help?
hi! is it normal if I receive a 'unhandled promise rejection' error from smth that is in a try block ? (js)
try {
msg.channel.send(permsEmbed) // it comes from here: it says that there is missing permissions (normal), but the catch block doesn't work
}
catch {
msg.author.send(permsEmbed)
}```
try/catch doesn't work on promises
use .catch instead
Promise().then(...).catch(...) the then isn't needed
thank you @amber fractal !
Or you could just handle promise rejections because putting a .catch under every message send is pretty finicky.
so I use pm2 and for some weird reason pm2 restarts my bot every time a file gets saved. here is ecosystem.config.js: https://cdn.lumap.me/4bda4xkl.png
normally it does that only if watch is set to true
is the everyone role's ID always going to be the same as guild ID?
according to the bot lol
lemme see
id of my server: 674514067368574976
id of the everyone role in my server: 674514067368574976
so the answer is yes
perfect, thanks
hey anyone got a github link for css and html
So in express, im trying to route /GUILD_ID and /GUILD_ID.json to the same router, so this is what i've done r.get('/:guild(.json)?'
however, it seems to be like, not ending the param? is there a way to force it to end the param or a better way of doing it to get the param and allow .json at the end of the url?
ok thanks
What's the name of that theme @tight plinth?
its not a theme, its a different ide
its called atom
I think the One Dark Pro theme in VSC is the same
if i change my bot name in discord dev portal, how long does that change take to propogate to the guilds the bot is in? when i change the avatar image the changes appear immediately, but i changed the name last night and its still showing as the old name in all servers
even when i click on the bot to view profile, its acting as though its username is still the old one
are you sure it isn't just cache fucking with you
What is its name right now?
its not in here atm, not applied yet, its my newest bot 🙂
ah
im positive, it was over 12 hours ago i made the change, and its only in 2 servers, both of them are showing the old name as the username
^ discord profile
^ dev portal
Did you restart discord?
can you send me its id real quick?
lol yea, i slept for like 10 hours in between with bot and discord completely off
711719298942500925
Wait, did you change the name in both the "General Information" and "Bot" sections
https://oliy.is-just-a.dev/4sw2e_4021.png looks like cache
Are you sure you changed your app's icon or the bot's one?
TypeError: this.inputMedia.pipe is not a function | help please
Because sometimes I change the app's name instead of the bot user's name
Oh
you need to change it in the bot section
why then would it be using the new name for new servers though
well that is the application name, make sure to change it in bot section
yea ill change it there and see 😄
fml
immediately changed
lmao
ty guys 😄
i totally blanked that it had a name input for the bot tab 😄
help
please.
ERROR: TypeError: this.inputMedia.pipe is not a function
thx for helping.
can't say anything without looking at code
post code and someone might be able to help
hey, i dont know if im aloud to code html in the site am i?
yes, you can use html in description
as long as you dont hide the ads your allowed
i need some help with docker(-compose)
does someone know how to create a .js website
my docker compose file starts 3 containers (web, db and ts)
web is the web api which connects to both db and ts
but for some reason it can't see either of those on the network
my docker-compose.yml: https://pastify-app.web.app/show/36lnoQvZzmFej1XbBxJz
this is the error when it connects to db (https://pastify-app.web.app/show/qorQE5F5H6MSGOu0Saqs)
to me, it seems like something is fucked with the docker network but i have no idea what it is or what to do to fix it
running docker network inspect networkname while the container is starting up (before it crashes because of inablity to load db) shows that it is connected to the network
(https://pastify-app.web.app/show/jDHoYY5BfvlYE5hry6dO)
i am making (free) bots
no
What do you mean by your bot uses JSON
.json
i am making (free) bots
@flat vine i'm pretty sure no one will need your "services" since you dont send anyone any code, you use your "hosting" which is definitely a security concern, so sorry but no one cares
heroku can support json?
@earnest phoenix what programming language do you use for the bot
python, javascript?
javascript
json is only a data type
js is supported by heroku afaik
so?, i can use json?
yes
its only a data type
ok thanks
How to define verification levels from a server ?
The command section under db is incorrect @next remnant
I don't think it'll work if you are using it as a database though
How to define verification levels from a server ?
do you want to set the verification level or just get it
@sacred wraith but it works?
the database container starts
only the network doesn't work
docker network i should say
even with host networking, it works
@sudden geyser just get it, i need for a serverinfo command
also, you can create a ccustom network for your applications
also, your applications can reference one another via thei given name
docker compose does that
What library are you using
The default network should technically work.
gamebot:9999 is the internal url for that one for example
the default network works fine
@sudden geyser discord.js
what version
v12
Don't you need a hostname: db in there @next remnant
Check out the enum of verification levels in the docs: https://discord.js.org/#/docs/main/stable/class/Guild
Ok
Ahh, I see. I use docker swarm, so a bit rusty on docker-compose.
yea compose sets the hostname to the container name automatically
@sudden geyser It still says undefined
how are you trying to contact the other apps on the network from your web app simp>?
const verlvl = {
0: "NONE",
1: "LOW",
2: "MEDIUM",
3: "HIGH",
4: "VERY_HIGH"
}
.addField("Security Level", verlvl[message.guild.verificationLevel], true)
it still says undefined
web server connects postgres with the jdbc driver
verificationLevel is a string.
and fails if host networking isn't used
The key should be the string like "LOW" and the value can be the user-friendly name like "Low"
👀 thats a new format to me lol
seems valid according to the docs. ive never used postgres 😛
oh, java
I'd not recommend using the postgres schema directly tho
also, if your database is in a vps, check if the port is actually allowed through the ufw
does The RichEmbed constructor has been removed and now the MessageEmbed constructor is used. It is largely the same to use, the only differences being the removal of richEmbed.attachFile (messageEmbed.attachFiles accepts a single file as a parameter as well) and richEmbed.addBlankField and the addition of messageEmbed.addFields mean i have to replace every "new Discord.RichEmbed()" to "new Discord.messageEmbed()"
yes
okay
I will try manually setting hostnames
Are you waiting for the postgres container? It's possible that it takes a bit of time to start up even with depends_on
Unlikely that this is the issue though, since it works with host networking.
i am not but that isn't the issue
what error are you getting?
is it a simple "couldn't connect to database" or something more specific?
host is unreachable
try pinging your server with command prompt
if the ping fails, then it might be port issues
I don't mean that
why r people using d.js after that wack update
is your database in the same server as your code?
@digital ibex What're the alternatives?
im running everything on my local machine
im running everything on my local machine
@next remnant then use localhost instead
that is not how docker networks work
there r quite a few other js libs which r so much better imo
localhost only works with host networking which is what eventually had to use but would prefer not to use
why?
that network isn't isolated
which whack update did d.js have?
anyone have an idea why ```js
module.exports = async (message, member, prompt) => {
const filter = response => response.author.id === message.author.id;
let channel = await member.createDM();
const instance = await channel.send(prompt);
return channel
.awaitMessages(filter, { maxMatches: 1, time: 180000, errors: ["time"] })
.then(collected => {
const content = collected.first().content;
return content;
})
.catch(_ => {
instance.delete();
return channel.send("You waited to long. (3m)");
});
};
Error?
no error
maxMatches is called max now afaik
U mean max, not match @pale vessel
It's like 7pm
good for you
No it's 20:40
whats this : TypeError: Discord.messageEmbed is not a constructor
Capital m
np all classes start with a capital letter 🙂
Imagine using the embed constructor
Imagine not
{
title: "Name",
description: "Description",
fields: []
}``` is better 
big nono for me if the embed has more than 1 field
imagine using an object
why not more than 1 field?
the constructor is more clean
there are valid use cases for both constructor and passing object to send imo
Object team
yeah, and cause it takes like 4 lines if I want it to be easily readable
b-but pichu uses constructors
hey is this the same rodeo every update?
The constructor returns a object, right?
i stuck to 11.5.1 until now lol
rodeo?
like mess for me
there's no such thing if you are talking about d.js and assuming bot is your Client
It's not documented so
yeah I can't find it too (on v11)
then where did you find it?
well, who wrote that code? Maybe they defined it somewhere else
bot.snipes = new Discord.Collection() for example
The snipes property doesn't need to come from discord.js
the heck is an embed channel
My bot is query the database much seen that is in over 100 servers. I'm having problem with the server that it's hosting it, its CPU usage spikes over 100% many times, because of the disk usage. I would have to upgrade drom a 2.5 $ plan to a 20$ one, just to get more CPU power. Do you guys know any good VPS that could offer me a little cheaper plan and solve my problem?
["command", "event"].forEach(handler => {
require(`./handlers/${handler}`)(bot);
});
Cannot read property 'forEach' of undefined
my vote webhook doesn't seem to be working, i tried regenerating my api key on the api docs but it doesn't reset
nor does it reset on the edit page of my bot
hi
if i have an array
how can i get the one i want?
like
i have js ['1', '2', '3', '{eee:ee}' ]; i can use find but i want to get to ee specifically in the 4th value
@opaque seal contabo. https://contabo.com/?show=vps
Powerful VPS hosting – SSD storage, snapshots, virtual machines equipped with brand new hardware, 100 mbit/s unlimited traffic, starting at just 3,99 EUR/month.
{choose#1:2} and thats in an array
so its basically
[ 'bye', 'hi', '{choose#1:2}' ];
and i need to get to '1' and '2'
using find, but then idk the part after the #
lol, i still have no idea what your trying to achieve. let me try understand..
you have an array, and one of the elements is a string with an object containing data. your wanting to find that specific data? just find it in the array, or if its always in the same position, get the element via array[index]
does anyone know what the cause is of this error? aiohttp.client_exceptions.ClientOSError: [Errno 22] Can not write request body for https://discordapp.com/api/v7/channels/705013428288487476/messages
yea, ive never seen that one aubee
so what it is, i think this is gonna make more sense,
i want to do hello, {choose#:how are you?:how is u?} i want to get to 'how are you?' and 'how is u?'
dekita do you know whats causing it?
so your array is actually an array of the arguments from someone sending a message?
i have no idea im afraid 😦
:(
const ary = ['hello', '{choose#:how are you?:how is u?}'];
const ele = ary.find(e => e.startsWith('{choose#'));
is enough to find the correct element
if this makes any mroe sense
oh
but i'm confused on how i can get to the values after the #
by either requiring a json format and then json parsing it, or by splitting the string in your desired format like umm..
Cannot read property 'forEach' of undefined
You still having this issue?
It's likely due to the line above.
Like a missing semicolon.
@earnest phoenix
the amount of choices shouldnt matter
then it would choose the e:ee
notice, i now have an array containing each choice.
oh
its just a case of formatting the data correctly, and then splitting it apart based on how you formatted it.
i would say though
the format your using atm is not ideal.
not even a little!
irrelevant. the principle remains the same. you just have to format the data in some standardized way, and then check for elements that match that format, then parse the data based on the format chosen, and handle the data accordingly.
someone experienced in mongoose db ?
i got this even if my ip is whitelisted Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist:
put the ip as 0.0.0.0 and that whitelists all ips
if u want to whitelist all ips then do that ^^
i've never had to specifically whitelist an ip for mongoose.
with atlas u have to
i used it once
deleted that project
and coulsn't get back into it cuz it was being stupid
so
if i disable the whitelist everyone who has my link with password etc can acces my database, no ?
i just use localhost now
tbf no one should have your password
uhh, yeah
and yes, as that is the intended functionality.
no one has my password, i just want to be sure
and how can i turn off the whitelist ?
put the ip as 0.0.0.0
ive never had any mongodb whitelist so idk 😄
here ? @digital ibex
in db access
oh, ok
ok
if u using linux use sudo ufw allow PORT
but if u want to open port
so now i can use it on any ip
i'm not getting any errors but now when i want to use my warn command i don't have any database created in app (for the warns )
u logged in tho?
do u have a 'mongoose.connect' somewhere?
yes
oh nvm, i restarted the bot 2nd time and it worked
create a member model
make a folder called 'models'
and in that folder, create a file called 'member.js'
it worked man now
@digital ibexone more question, now if i want to delete an user from database i simply delete this?
Cannot read property 'length' of null
warns.find({ Guild: message.guild.id, User: user.id}, async (data, err) => {
if(err) console.log(err)
if(data.length) {
const p = new MessageEmbed()
.setColor("#ff9900")
.setDescription(`:white_check_mark: **${user.user.tag} has not got any warns!**`);
message.channel.send (p);
return;
}
let f = new MessageEmbed()
.setTitle(`${user.user.tag} has ${data.length} warns`)
.setColor("#ff9900")
.setDescription(data.map(d => {
return d.Warns.map(w => `Moderator: ${message.guild.members.cache.get(w.Moderator).user.tag}, Reason: ${w.Reason}`).join("\n")
}))
message.channel.send(f);
wait you connected to mongodb from glitch?
@grizzled raven yes
man what am i doing wrong
i wanna use mongodb on glitch so i can play around with mongodb
We're the creators of MongoDB, the most popular database for modern apps, and MongoDB Atlas, the global cloud database on AWS, Azure, and GCP. Easily organize, use, and enrich data — in real time, anywhere.
last time i tried i was probably stupid 
yeah ik about atlas
idk just didnt know what to do i guess
@earnest phoenix if (!data.length) return //...
data is undefined tho
In Node.js v14 you can just if (data?.length) but you'd need to check if data is valid for versions below / not supported yet.
@earnest phoenix the error is at embed
how would you check if a guild has a specific role?
but that finds it. i already tried that
so, it worked?
nope
how so?
try {
const verified = message.guild.roles.cache.has(r => r.name == `${permrole}`)
return message.channel.send({embed: {
color: 16733013,
description: `Your permissions role has been saved! "${permrole}"`,
author: {
name: message.author.tag,
icon_url: message.author.displayAvatarURL()
}
}});
} catch (err) {
return message.channel.send({embed: {
color: 16733013,
description: `This is not a valid role in your server\n**This is case sensitive!**`,
author: {
name: message.author.tag,
icon_url: message.author.displayAvatarURL()
}
}});
}```
v12?
why are you args.join() them?, nvm i think i know
node 10
nvm i fixed it
ok..
hi
does anyone know why when i add something onto the commands response, it doesn't even send the commands response?
i have
if (message.content.startsWith(`${prefix}${a.name}`)) {
/* do whatever i need to do here */
}```
did you restart your bot
You'll need to show more code
what else would be effecting it?
i have above it: ```js
let a = guild.commands.find((e) => args.join(' ') === e.name);
if (a !== undefined) {
}
have you checked to see if a was undefined?
i haven't
I would suggest doing that first
embed.attachFile({ attachment: canvas.toBuffer(), name: 'thumb.png' });
= v11
embed.setFile({ attachment: canvas.toBuffer(), name: 'thumb.png' });
= v12
just console.log(a) in between those lines
yes
are you trying to add an image?
attachFiles is v12
there is no setFile
hmmm
a is undefined if the command doesn't exist
if it does its { name: 'command name', response: 'command response' }
it does register the command
hi
im trying to put my bot onto an online server
but im not too sure what im supposed to do
to server hoster is called heroku and my bot is in pyhton
can anybody help me
um
yeah my bot works fine
its just getting it to run on the server
:))
What is the issue? Is there somewhere you are stuck wi'th heroku?
How to host your discord bot for free using heroku. This tutorial shows you how to host your python bot for free using heroku services. We simply need to setup a few things to heroku, upload our code and turn the bot on!
Text-Based Tutorial: http://techwithtim.net/tutorials/...
(node:22760) UnhandledPromiseRejectionWarning: TypeError: guild.roles.fetch is not a function'
just how
another Tim o_o
and what djs version
He uses v12
lets check testing
message.guild.roles.fetch()
TJ your fault 
its in a guildCreate event
can you log the entire event and see what it returns for just guild.roles
if it returns the collection then it should be correct
Let me check my test bot
it should return a GuildRoleManager
guild.roles returned GuildMemberRoleManager {
then it should work
make sure it doesnt need cache either
it doesnt
.fetch methods are always on the manager, not in the cache
you said this started after you added mongo?
yea....
did you by any chance redefine some guild property?
nope
i made sure not to
if the code helps
async run(client, guild) {
const mongoURL = process.env.DBURL;
const dbName = process.env.DBNAME;
const dbClient = new MongoClient(mongoURL, { useUnifiedTopology: true });
dbClient.connect(function(err) {
assert.equal(null, err);
console.log("Connected successfully to server");
const db = dbClient.db(dbName);
dbClient.close();
});
let guildRoles = await guild.roles.fetch(),
mixerRole = guildRoles.cache.find(role => role.name === `🎵 Mixer 🎵`);
if (!mixerRole) {
guild.roles.create({
data: {
name: `🎵 Mixer 🎵`,
color: '#FF0092',
}
});
}
}
and if you remove mongo it works again?
nope
still errors
maybe the problem is that im using a command to emit a guildCreate event?
im testing your code now too
do you create a fake guild object?
ah wha
show the command that emits the event
Mine worked fine like this
client.on("guildCreate", async (guild) => {
//console.log(await guild.roles.fetch())
let guildRoles = await guild.roles.fetch(),
mixerRole = guildRoles.cache.find(role => role.name === `🎵 Mixer 🎵`);
if (!mixerRole) {
guild.roles.create({
data: {
name: `🎵 Mixer 🎵`,
color: '#FF0092',
}
});
}
})```
This created my role
client.emit("guildCreate", message.guild);
🐒
it had message.member instead of message.guild
oh
ah
we did it reddit
haha
of course, thats why it returned GuildMemberRoleManager and not GuildRoleManager
i felt it was weird but i assumed i just didnt remember it right
how could Tim be wrong lol
i can be wrong many times xD
i have yet to see you be wrong
hahah
I know python, what do you need help with?
boolean?
What do you mean?
another question
.on(`nodeError`, table.addRow(`Music`, `❌`))
.on(`nodeConnect`, () => table.addRow(`Music`, `✔`))
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of AsciiTable
it gave me that error
event.on('listener', function => {
ee
}
thats not how you define an arrow function
i accidently backspaced too far lol
If you need to remove something you need to modify the object and rewrite it to the file
Read JSON from file --> modify object --> write to file
wut turtle
what do u mean with modify obj
i was showing example oop
The JSON data is the object
yes
Java Script Object Notation
this is an object ```js
{
key:value,
anotherkye:anothervalue
}
you have 2 copies of this object, one in the json file, another one inside the bot
you edit the object inside the bot, then you save it to the file
if you want to remove something, you remove it from the object, then write the object to the file again
but then it will be
{
}
``` right
you can also use delete object['key'] for this
for example ```js
delete object.anotherkey;
fs.writeFile("file.json", JSON.stringify(object))
Here is an example for you
let myjsonobj = {
"employeeid": "160915848",
"firstName": "tet",
"lastName": "test",
"email": "test@email.com",
"country": "Brasil",
"currentIndustry": "aaaaaaaaaaaaa",
"otherIndustry": "aaaaaaaaaaaaa",
"currentOrganization": "test",
"salary": "1234567"
}
delete myjsonobj['otherIndustry'];
console.log(myjsonobj);```
Kinda old but you get the point
i guess 😄
XD
:)
I noticed when I started using v12 you cant mention the user with message.author
Whats the correct method for this version?
It looks like you have to use <@ >
@tired nimbus I personally use the ID to tag someone
Also if you need to mention the author you can do this message.reply()
like this
<@id>
so it got removed in v12?
@magic jackal
this works too
I dont think so its probably renamed
are you trying to mention the author or a user?
try this message.author.toString()
If you want to reply to the author of the command sender, you can also use message.reply('wow mentioned')
Yeah its a small learning curve
This is where I found it btw
this too
RangeError: Invalid WebSocket frame: invalid payload length 126 any idea why?
like
hm
Lemme show you code
does anyone know why my bot only shows 18k of users and the server has 103k?
I have one problem @quartz kindle,
when the bot joins a server it adds it to the file.
But it only removes it from the file when I reload the bot aka save the JSON file and node .
cache
Check out this latest snippet on codebin.it
@earnest phoenix detect it with a readfile, if it exists then delete it
@earnest phoenix thats why you should always keep a copy of the file in memory
how are you reading the file? with fs.readFile?
@mystic violet where are you sending this to?
@magic jackal sorry TJ kinda got stuck with my brother lol maybe later

@magic jackal Thank you so much, it almost worked, i was under the impression i had to add something to my code, like web.py or something, but now when i upload it it says
ah nice, now its just a module missing
ok but in my code its there
discord is missing so you'll need to push that to the heroku server too
whats the function that lets you make a command that like lets you have the bot leaves servers

