#development
1 messages · Page 570 of 1
im thick af
bruh
Lmao
there is an doc
https://discord.js.org/#/docs/main/stable/class/ClientUser?scrollTo=setActivity here are your docs, read them
smh spider stealing my mute
ooo he got muted?
yeah lmao
Thank god not trying to be rude
Anywayy
ima go and try and make a discord.js doc cmd
Oh wait
I forgot I had a question of my own
In a help cmd how could I make certain cmds show up for people who have certain permissions
Like this:
Wouldn't I have to do a permission check?
Yes
and if so add that to the embed
Get a list of their perms, if they have the perm you want add it
Hm mk
so something like
if(message.member.hasPermission("ADMINISTRATOR"){
.addField("Admin commands:", "admin commands here")
}
if(!message.member.hasPermission("ADMINISTRATOR"){
.setFooter(`The Admin commands are not showing as you don't have permission `\`ADMINISTRAOR`\`\`)
}
Like that or smth
store the builder in a local variable
RichEmbed builder
Oh ok
let embed = new RichEmbed({ title: "Help embed" });
for (const [name, { conf }] of Object.entries(client.commands)) {
embed.setDescription(`Anything in [] are optional, anything in <> are required!`)
embed.addField(`${name.slice(0, 1).toUpperCase()}${name.slice(1, name.length)}`, `Description: ${conf.description || "N/A"}\nUsage: ${conf.usage || "N/A"}`);
embed.setColor("#fff")
embed.setTimestamp()
embed.setFooter(`Requested by: ${message.author.tag}`)
}
I already have it setup like this
Hm I have an idea
Mk but why would I store the RichEmbed builder in a local variable?
What is the point of that? If I may ask
Oh yea you right LOL
const resp = await db.startsWith('userBalance', { sort: '.data'});
resp.length = 5;
let finalOutput = '**Leaderboard**\n\n';
for (var i in resp) {
finalOutput += `${bot.users.get(resp[i].ID.split("_")[2]).tag} -- ${resp[i].data} usagibux \n`;
}
message.channel.send(finalOutput)```
apparently I cant fetch the user
can someone help me
TAG ME
let embed = new RichEmbed({ title: "Help embed" });
for (const [name, { conf }] of Object.entries(client.commands)) {
embed.setAuthor(`Anything in [] are optional, anything in <> are required!`)
embed.addField(`${name.slice(0, 1).toUpperCase()}${name.slice(1, name.length)}`, `Description: ${conf.description || "N/A"}\nUsage: ${conf.usage || "N/A"}`);
embed.setColor("#fff")
embed.setTimestamp()
embed.setFooter(`Requested by: ${message.author.tag}`)
}
if (message.member.hasPermission("ADMINISTRATOR")) {
for (const [name, { admin }] of Object.entries(client.commands)) {
embed.addField(`${name.slice(0, 1).toUpperCase()}${name.slice(1, name.length)}`, `Description: ${admin.desc || "N/A"}\nUsage: ${admin.use || "N/A"}`);
}
} else if (!message.member.hasPermission("ADMINISTRATOR")) {
embed.setDescription(`❎ Admin Commands are hidden for you`)
}
Error:
TypeError: Cannot read property 'desc' of undefined at Object.run (C:\Users\Aj\Desktop\The Clinic\commands\help.js:20:132)
admin isnt defined
Well thats what that means, it cant read the property desc of undefined, which would be admin
Well yea I know what it means I am just confused why I am getting it
when I have admin defined
the same way as conf
and conf works
npm:
{ admin:
{ name: 'NPM',
desc: 'Allows Admins to search up NPM packages',
use: 't!npm <query> or @The Clinic npm <query>' },
run: [AsyncFunction: run] },
It shows up in console
when I log client.commands
Can you log admin tho?
I will try
undefined
undefined
undefined
undefined
undefined
undefined
undefined
{ name: 'NPM',
desc: 'Allows Admins to search up NPM packages',
use: 't!npm <query> or @The Clinic npm <query>' }
undefined
undefined
undefined
undefined
It returned undefined for every cmd that didn't use admin until it got to the npm.js cmd that has admin
you're using a for of loop
Yea
it will iterate over all entries
Hm
How can I make it iterate over just the cmds that have admin
or is that not possible
just skip iterations that dont have it
How could I do that?
if(!admin) { continue; }
continue tells the loop to skip the current iteration and begin the next one
Hm
I kinda understand but I don't at the same time
I'd put that in the for loop right
Wait continue just skips that increment thatd be helpful to know 
yes, right at the beginning
and yup, continue skips an iteration, and break exits the loop
I new about break
didn't know about continue
undefined undefined undefined undefined undefined undefined undefined { name: 'NPM', desc: 'Allows Admins to search up NPM packages', use: 't!npm <query> or @The Clinic npm <query>' } undefined undefined undefined undefined It looks like it still iterates over all of them
Oh wait
Should I do the same thing to the other forloop?
if(!conf) {continue;}
if not all commands have conf, then yes
@loud salmon roleplayer is on rank 62 
oh
lol
i clicked on the second channel in the category, didnt realize i had it minimized 
lmao
yeah, without the quotes
clicked on second channel in the category so there is a hidden channel above genera eh :^)
If you do text it does not embed in the message but if you delete the message it will be a clickable link text in the delete preview thing
then you're doing something wrong
well, show code?
its a string...
^^
not whatever the fk you're doing lmao
^
Ahhhhh
Yeaaa
Fuck
Thanks for telling me
Rip
I forgot how to handle the object Object thing
You cant send the entire object, just values from it
Yea
.versions['0.1.0'].maintainers is an array probably of maintainers. there may be an easier way to do this tho
Doesn't npm have an API though?
I searched for npm api and got https://www.npmjs.com/package/npm-api idk if thats what you want tho
No
I don't think so
Yea no it isn't
I was wondering if npm itself an an api and or api docs
I am trying to get info on other npm packages
Wait I was dumb 
<Object>.maintainers is an array of objects
for your purpose
You'd have to loop over the array and get the values of the names
If I went to the undefined package that he sent, its the same thing anyways
How are you getting the data right now tho?
<header class="masthead text-center text-white">
<center><br><br><br><br><img style='border-radius: 50%;' src='https://discordapp.com/api/v6/users/<%=user.id%>/avatars/<%=user.avatar%>.jpg'>
<center><h1><%=user.username%></h1></center>
<form action='/panel' method="post">
<div class="form-group col-md-6">
<label>User ID</label>
<input type="text" class="form-control" placeholder="User ID (E.G: 489545273106890743)" name='botsID' required>
</div>
<div class="form-group col-md-6">
<label>Item</label>
<input type="text" class="form-control" placeholder="-" name='db' required>
</div>
<div class="form-group col-md-6">
<div class="col-auto">
<button type="submit" class="btn btn-primary mb-2">Add </button>
</div>
</form>
</center>
</header>
when i submit that
i want to have success
ive been trying
alerts
like 1h
;-;
@amber fractal By using an npm package called api-npm
that is what I been using^
It seems like it does the same thing as the registry 
lol
@amber fractal Kinda ig I think registry has more info though not sure
¯_(ツ)_/¯
Whatever works tbh
How would I pull data from https://skimdb.npmjs.com/registry/
I did it with steam but I can't remember
I am using superagent
My thing is getting the data
from the latest version
of the npm package
I can't figure that part out
This is my command now
I know it is wrong lol I just can't figure out how to get info on the latest version
of the npm package they search up
there is no version info in there
nvm
latest version should be ["dist-tags"].latest
MK
But don't new contributors pop up in different versions of the npm?
and many other different things from other npm package versions
yeah but do you need all that?
Well it is an npm package lookup cmd
so yes and no
I mainly just want general info
like
do this then
the dependencies, version, maintainers, license etc the important stuff
body.versions[body["dist-tags"].latest]
that should give you the details of the latest version
yes, its the entire version info
now you need to get the data you need out of it
you can console.log it to see what it contains
Ok
{ name: 'undefined',
id: 'undefined',
version: '0.1.0',
description: 'Just require undefined & everything gonna be defined!',
author:
{ name: 'Irakli Gozalishvili',
email: 'rfobic@gmail.com',
url: 'http://jeditoolkit.com' },
homepage: 'https://github.com/Gozala/undefined',
keywords: [ 'undefined', 'JS', 'troll' ],
repository:
{ type: 'git',
url: 'https://github.com/Gozala/undefined.js',
web: 'https://github.com/Gozala/undefined.js' },
bugs: { url: 'https://github.com/Gozala/undefined.js/issues/' },
_id: 'undefined@0.1.0',
dist:
{ shasum: '9b706a4b32ad30c20ca4fe65ddcbbbdac32bded0',
tarball: 'https://registry.npmjs.org/undefined/-/undefined-0.1.0.tgz' },
_from: '.',
_npmVersion: '1.2.25',
_npmUser: { name: 'gozala', email: 'rfobic@gmail.com' },
maintainers: [ { name: 'gozala', email: 'rfobic@gmail.com' } ],
directories: {},
deprecated: 'this package has been deprecated' }
Does it matter if it just showed package that doesn't exist?
what do you mean?
When I console logged
body.versions[body["dist-tags"].latest]
it gave me that up there ^
but that npm package doesn't exist
well, it clearly exists
Mk but next question
why did it return that and not the package I asked it to look up...
you made it search for "undefined"
ye
cause I asked it to look up express
if your args already removes the command itself
then it should be args[0] not args[1]
well, i dont know either, im just saying thats what happens if it does
btw this is the "undefined" package
lmao
how the fuck does it get 5k downloads/week
Lol
Wtf
What is the point of it?
I mean its deprecated now
So but still
What was the point of it when it could be used
Lol ok
console.log(test) // undefined```
Lol
Mk, I hope I can remember how to get the stuff I need uwu
How could I loop through and get the contributors?
wouldn't I usea for loop?
Hm
With | in between each one
So it would be like
Name 1 | Name 2 | Name 3 |
and so on
so a concatenated string?
you can use a for loop yes, or you can use map then join
How could I do the map method?
its an array of objects, so first you need to turn it into an array of names
assuming you dont need their email addresses, just the names
newarray = array.map(item => item.name)
Ye just their name
this should give you a new array containing only the names, without the emails
then you can take the new array and do .join(" | ")
.addField("Contributors:", body.versions[body["dist-tags"].latest].newArray.join(" | "))```
?
Like that?
oh wait
That wouldn't get me their names
or would it?
wouldn't I need to define I want the contributors names?
Oh wait
I get it oof
lmao
let newArray = array.map(item => item.names)
.addField("Contributors:", body.versions[body["dist-tags"].latest].newArray.join(" | "))```
Something like that?
that is wrong on so many levels
array should be the array containing the contributors
that you get from the version object
also, when you use .something, the dot means its continuing from whatever it was before it
if you do .addField() there, it will be the same as doing .map().addField()
which doesnt exist, maps dont have an add field function
Hm true
I didn't think of that
Also I wasn't trying to do it right after the .map()
I have a let embed = new Discord.RichEmbed()
I was just putting it together to see if I was correct or wrong
ah okay
Yea xd
So how would I get the contributors names then?
I would have to define I want the contributors name somehow
names*
well, start from the beginning. where are they? they are in the version object. how do you access the version object?
body.versions
the specific version you want to work on
body.versions[body["dist-tags"].latest]
yes, now access the contributors array that is inside it
body.versions[body["dist-tags"].latest].contributors
yes, now map it to a new array
yes
very good
now you can assign all of this to a variable
or just join it right there
let conArray = body.versions[body["dist-tags"].latest].contributors.map(item => item.name)
yup
sure
nvm
just use less fields?
^
Then theres too many dependencies and it goes above 25
Ah ok
You can put all the dependencies in one field if you want tho
wdym?
Instead of adding a new field for each one, just put it into a string and make a new line for each one
how would I do that?
You see your for loop for dependencies?
Ye
Instead of adding a field each time, add the dependency to a string and a good '\n' or comma, whatever you choose.
then add the string to the embed
instead of a new field for each dependency
hm
I can't remember how I could add it to a string
wouldn't I define a new variable of an empty string and add the dependency to that?
let str = "" str += "test\n"
Define str outside of the loop
or whatever you use for your string
if you add another ` to the end, it should work. If dependencies is what you want added
I made this in around 8 minutes
Ah ok thanks
@amber fractal how could I separate it with | instead of on a new line or would that fall into it exceeding 25 fields?
`${dependencies}|`
you meant that or
`${dependencies}\|`
Like that?
Ye
thats how i want it
for (dependencies of Object.entries(body.versions[body["dist-tags"].latest].dependencies)) {
embed.addField(`❯ Dependencies\n`, str += `${dependencies} | ` || "Null", true)
console.log(dependencies)
}
I have this
but it returned the same thing
25 limit thing
You are still adding the fields
Add it to the string then embed.addField(`Name`, str)
You'll need to slice off the end if you dont want a stray "|"
Hope you get it working :+1:
Thanks <3
btw, Objects.entries() returns an array
Oh wait
Im just dumb
Didnt know you could loop over an array with of like that
Show a bigger image of the embed
Is that in the title?
Titles have a url option
really....
.setTitle("Title")
.setURL("URL")
If you want to kill your system, you could also make it link every dependency 
Wait I guess it wouldnt kill it
actually it wouldnt really do much I was just being really dumb
Imma go to bed now
Oh but it exceeds the character limit pretty quickly
Huh?
Ignore that
Okie lol
It was just my train of thought at the time
Ah ok
I am trying to figure out how to get rid of the | and another thing
I forgot how the .slice() method workss
works*
how does
console.log(str.slice(-4))
work and it returns just dog?
Because the start index is 4 from the end of the string
i.e. "dog."
Look at examples
Theres one for slicing the end of the string
I am but they don't make much sense
:+1:
positivenumbers makes it begin at the front negative makes it begin at the back
Correct?
Yes
Mk, that makes sense now lol
Dont confuse it with the startIndex and endIndex tho
Like in the example they use a negative start index and a positive end index
Wait
I will look at that later
Idk if they do that or not 
Didnt actually look at them that close thpught I saw it while scrolling
Now i need to find it
Ah yes, they did
Wait what?
Youd need (0, -1)
Yea
there is
UwU
I put a space between the dependency and the |
and
I think
Nah nvm it was the space I put between dependency and |
Either way, I'm gonna get to sleep, for real
String.prototype.replace(/{your string here}/g, '') //g means global so it will remove all of the indicated string
They are just trying to remove the end
ahh
Lel
They have an extra space
0, -2
Instead of 0, -1
That will cut the 2 characters "| " off
Did not think of that
heyo,
what would you guys say is the best solution if you need a database that every shard is accessing in parallel? What if the shards are on different servers?
Any ACID compliant db should work
Most of the popular db are designed for parallel access
okey i thought so. altough when i tried it once with mysql i received some strange "lock" errors
yeah a table may be locked
If you get that error, something prob call to lock the table in your code/w/e
i was firing writes from multiple shards to the same table "at the same time". so with a lot of shards they might block each other?
It shouldn't unless they all lock the table when they are writing
ok thank you very much
[your text](www.somewebsite.com)
thx
npnp
wait what?
message.channel.send(`${message.author}, ${args} is not a valid number`).then(msg => msg.delete(5000));
message.channel.send("Auto Rolling! :game_die: ")
setTimeout(function() {
.then((msg) => {
diceRoll = Math.floor(Math.random() * 6) + 1;
msg.edit("Your dice landed on: " + diceroll);
})
}, 5000);```
.then((msg) => {
^
SyntaxError: Unexpected token .
at new Script (vm.js:84:7)
at createScript (vm.js:264:10)
at Object.runInThisContext (vm.js:312:10)
at Module._compile (internal/modules/cjs/loader.js:684:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)```
he calling then on { xD
Tim dm?
i dont have time now
😦
how do you make the logo in your DBL website to bounce
Hello My Bot Is Still Waiting For Approval How Can I Confirm
If is waiting for approval you have to wait minimum few days
But it was about 8 days
It was no more than 6 days
how to have the logo bounce in our dbl website
ik that
but how
like i have my website in changing colors, but idk how to get the logo to bounce
I wish I knew, but if it's js then you just can't
if you don't know how to do css animations use animista
@spare glen google css keyframe animations and css transform
duckduckgo*
is there is any website
that lists links for songs, like 1k music links on youtube
for autoplaylist
@harsh nova you can just use inspect element
yeah but I cant find the element
Right click, inspect
oof I found it
I used preview mode before
I'll blame my lack of good boie points on that
i have no clue on how to make the logo bounce
could someone join the DBL site and help me with it
Just jump up and down and it will bounce 😛
@spare glen use animista.net
they proboly have something
you could use slide with infinate and alternate-reverse on
good luck
Anyone good at ejs?
ask your question
I’m trying to hide an alert , until someone does submit
but I tried a lot of methods
none of them worked
nope
bootstrap?
This is what I use on my dashboard and it works good. https://getbootstrap.com/docs/4.0/components/modal/
@harsh nova i have what u said
what now
i generate code then what
like how do i add the code to the logo
css
yeah, but but but
how do i add it to the img
look, i have that
how do i add it to the logo in DBL
css
to get back the first mention we make
let user1 = message.mentions.members.first ();
but for the second one how?
its a collection
read the docs on it and you'll work it out
you can also just make it an array and choose the 2nd element
BRo, how the fuck do i get the logo from my DBL site so i can add code to it
I have to use the collection.on ?
what?
read the docs²
@spare glen inspect element, find the logo id, use css to add the animation to it
try it and see
¯_(ツ)_/¯
lmao
do you even know css
or are you just copy pasting tutorial code hoping itll work
i just started
So basically is it possible to get banned on Discord for your bot hitting the message limit constantly? Becuase i'm thinking of adding an optional global chat to my bot and just want to know before i release it. Btw my bot isn't that big its in 208 servers. Thanks!
if you spam the api you may get ip banned
your account is unlikely to get banned
but the bot may be ip banned and you'll get an email
use a library that handles ratelimits for you or develop your own ratelimit handler
staying inside the ratelimits doesn't mean it's not spam
Hmm, ok thanks! I'm not going to release it.
nevermind what i said above, i thought it was game <-> discord chat link, global chat is a nono
xD Thanks anyways, i'm not going to release it
whats the class name here
is it just votebutton
or the whole name
cause i tought we couldnt have spaces
Its in quotes
@quartz kindle does that mean i gotta do votebutton, btn, btn-orange, btn-2x { background-color: black; color: orange; }
nvm i did it
but can you have font-weight: bold in a <p></p>
yes
@spare glen you dont need to target all classes, you only need one
k
and you can assign css to a <p> tag by targeting it
you can target tags by the tag name, or by giving it a class or an id
Is there anyone who hosts on vultr?
I do glitch
Cuz how the f do I get access to console?
you didnt create any password?
@tender sandal #502193464054644737
@tulip ledge you should get a root password in your email
unless you set up ssh keys I guess
in which case you should ssh into it
@tulip ledge go on the dashboard, you will see
IP
USER (root)
PASS
I did not get any password
YEs I know
But in the password it contains numbers
(96) and when I put it in the console it show (^ and it sais its invalid
try with console app like putty or something?
How would i go about making my bot only send a message/picture if it is a NSFW channel? In JS
do you have shift stuck or something
No
can someoen send me link for the document about js how to make timer bot
🤔
Why do you guys pay $5/gb for a vos
vps*
For only hosting a discord bot
port 22 is open by default and root login is allowed
While I pay $3/gb/month
/gb?
yes vultr = $5-> 1gb vps /month
he means ram @bitter sundial
the password field doesn't show what you're typing for security
what
2gb ram?
tf
20gb storage
I just noticed we are in #development oh god my bad

@earnest phoenix if (!message.channel.nsfw) return after the return do your other stuff message or something
the fact that password does not show up confused me extremely when I started using ubuntu
5$ = 1GB ram, 1 CPU, 25 GB SSD, 1TB bw
Yea i got it figured out, i was just thinking over complicated but thanks anyways :)
What do I put here? Just root or what
yea
Does anyone know how I install node on it
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
look it up for your distro
How would I get a guild id in eris?
I tried message.guild.id
isn't message.guild.id discord.js?
I am in need for some beta testing for a new bot. I'll gladly offer the same in return.
@earnest phoenix Yea, didn't think about that,I am used to using d.js xd
how hard is it to convert from discord.js to eris?
I keep getting told to convert my bot to eris
if your bot is decently sized you're better off rewriting it in eris
you get more features by default aswell so that's that
@marble needle Thanks, figured it out though, although I don't get why you have to go through the channel to get he id of the guild
its not real big yet
i mean you can rewrite it for shits and giggles, future proofing™ and for the experience/fun along the way. i've always been told eris does better performance wise when your bot reaches a fairly large size. But keep in mind that there aren't too many people out there throwing around eris based code you can use. You'll have to figure out most of it yourself
how hard the conversion ends up being depends on your programming knowledge and ability to use lib documentation 
eris doesnt have more features than djs
not afaik
some say eris is more efficient in terms of memory and cpu usage, but djs v12 should be equally good
can i type php and it still will work
like i have html code right, but if i type php instead of html
if you don't run it through php, it won't lol
php.html will definitely wrok, yes
so i can do index.php.html
you mean php tags?
i wanna create a contact form
with php
do i need to change the name from index.html
to index.php
if you have something that runs .php files in a php interpreter
but like, i wanna do a contact form with php in my index.html file. will it work
php is a programming language, html is a markup language and they aren't nowhere near the same
it's like asking if a png file will turn into ascii art if you change the extension from png to txt
then how do i add a php contact form to my html file
beats me
write it in html
google around
Hey so I'm hosting on vultr and I just set up my mysql database but I can't get out of its shell how do I get out of it?
Yeah but you could have the token of one of your other bots maybe
Are you returning before client.login?
and its almost impossible to have anothertoken
there is a ready above
login is a promise
you should do js client.login('my token').then(console.log).catch(console.error);
so it logs the result of the login function, if the login succeeded or not
doing the way you did will always log "On" regardless if the login worked or not
@quartz kindle hello hope you have been well buddy 😃 i have a question how can i add pages to my radio command as i have 50 radio stations but its shows 1-25 and then 26-50 underneath it
Should i decline?
No it's fine
i deleted the bot i uploaded because the post mentioned NSFW commands and now I tried to upload it again and it says "• Bot Already Added" but it doesn't appear in my profile, should I talk to a mod or admin?
@ocean vine See in #logs if @gilded plank Says you've added a bot then click the link and remove it... I think...
You could have just edited your bot to remove the NSFW stuff
no need to have deleted it
yeah i did but then i thought, maybe i'll have to wait a week and they'll see the original post, not the updated one
@earnest phoenix it worked
thanks
What are easy features that i could add to my bot? Already has coinflip, info, mirror
8 ball
But, like pictures of certain dogs?
Wrong URL
i dont understand it
on what page
What service?
@spare glen the page you went to doesnt exist obviously
What doesnt exist
What the fuck
I made a fucking contact form
I presses the submit button
And that happend
Wtf is the problem
What page is it suppose to create
What the fuck
I did the code in my html file, styled it in css file, and coded the php part in contact-form-handler.php file
And the action is directed to the php file
wait are you trying to run php in netlify
Yeah
Then what free webside host should i use
dont use php
idk
glitch
glitch doesn't have php interpreter
True
000webhost supports php
Oh
glitch does have php
000webhost is a joke
000webhost
down for 1 hour every day
but still
just like many free things
000webhost, is it a thing
Does 000webhost support php
...
I literally said it
google is a thing
wtf
Salty
h0w b8g should 8 make it
??
Just thank you and bye
@bright spear man, get me back into cert chat
lol i wish
My bot adds the role but dosen't remove it. Does anyone know why?message.channel.send(`<@${wUser.id}> has been temporarily muted`); don't even go off.```js
if(warns[wUser.id].warns == 2){
let muterole = message.guild.roles.find(name, "muted");
if(!muterole) return message.reply("You should create a muted role. quick tip: do -tempmute @ranom guy 1s");
let mutetime = "10s";
await(wUser.addRole(muterole.id));
message.channel.send(`<@${wUser.id}> has been temporarily muted`);
setTimeout(function(){
wUser.removeRole(muterole.id)
message.reply(`<@${wUser.id}> has been unmuted.`)
}, ms(mutetime))
}```
so don't await?
no
thats not how you use await
and what syntax highlighting did you use cuz u didnt use js
I got no errors
here is the wole code https://github.com/Madmadz16/FirstBot
plz ping me or msg me
@rocky dagger dont "copy from yt"
actually learn javascript first
then discord.js
dont copy code cuz it wont work
also why tf are you using ```css when its not even css
do you even know what language that is
Anyone knows how I fucking fix this
@tulip ledge What's the code?
I fixed it
great
hello
How volatile is running a stateful db in k8s container 
Does anyone know how to fix this weird glitch
So I have 100000 I do .toLocaleString('en-IN') and it gives 1,00,000
And it should give 100,000
can someone help me with my code?
what language and library
discord.js
aye, I could try
So the problem is that the bot adds the role but dosn't remove it. ```js
if(warns[wUser.id].warns == 2){
let muterole = message.guild.roles.find(`name`, "muted");
if(!muterole) return message.reply("You should create a muted role. quick tip: do -tempmute @ranom guy 1s");
let mutetime = "10s";
await(wUser.addRole(muterole.id));
message.channel.send(`<@${wUser.id}> has been temporarily muted`);
setTimeout(function(){
wUser.removeRole(muterole.id)
message.reply(`<@${wUser.id}> has been unmuted.`)
}, ms(mutetime));```
any errors
no
wait, why would you addrole by id
when you have the obj
im tired so im confused
I better just stay away from code
This doesn't workjs setTimeout(function(){ wUser.removeRole(muterole.id) message.reply(`<@${wUser.id}> has been unmuted.`) }, ms(mutetime));
or thisjs message.channel.send(`<@${wUser.id}> has been temporarily muted`);
mutetime will not work
node.js is in miliseconds
so 10 seconds would be 10000
or 1000 * 10
oh wait
did not see the ms, sorry
the temporarily muted message also doesnt work?
no
but the mute role works?
only adding it
that means something is breaking and interrupting the code there
can you try putting a catch block there?
like this
wait shouldn't it just be (muterole)? without the .id
try {
await wUser.addRole(muterole.id);
await message.channel.send(`<@${wUser.id}> has been temporarily muted`);
} catch(e) { console.log(e) }
you should make customizable time
this wouldn't be correct?
let mutetime = "10s";
await(wUser.addRole(muterole));
message.channel.send(`<@${wUser.id}> has been temporarily muted`);
setTimeout(function(){
wUser.removeRole(muterole)
message.reply(`<@${wUser.id}> has been unmuted.`)
}, ms(mutetime));
instead of muterole.id
both work. role functions accept a role object or a role id
ah ok
the await isnt correct
What's correct then
uh
I have herd that before
without the brackets
natan dropped by yesterday and said its fine to use await like that
anyway @rocky dagger have you tried what i told you?
anyone use Travis CI on private repos?
try {
await wUser.addRole(muterole.id);
await message.channel.send(`<@${wUser.id}> has been temporarily muted`);
} catch(e) { console.log(e) }```?
yes
it didn't work
does anything come up in the console?
nope
yeah try this:
try {
console.log(muterole.id)
await wUser.addRole(muterole.id);
console.log(muterole.id)
await message.channel.send(`<@${wUser.id}> has been temporarily muted`);
console.log(muterole.id)
} catch(e) { console.log(e) }```
nope
does it log something?
no
want to see the wole code?
I learned the same way, but if i could go back i would learn the basics first
but anyways, is warns[wuser.id].warns 2?
where?
what ever that means
mate
"warnings.json"
there should be a obj lookinbg like this ```json
{
"id"{
warns: number
}
}
now this is probobly invalid json
but you get the point
i get this in the console tho (node:19584) DeprecationWarning: Collection#find: pass a function instead (node:19584) DeprecationWarning: Collection#find: pass a function instead
yes
you are using a old function
not error but it will get depracated
dont worry about that rn
yeah
find("name", "test") became find(u => u.name == "test")
Not passing a function wont work in the future
I feel like I just skip this whole thing lol
{"<userid>":{"warns":2}}
"<userid>" or your id
When people do that it typically means it as a place holder.
my id
aight
it is
if it is 2 it should work
Its valid
if you run the code now it will not run the code
since it would add another warn and it would be 3
and your code triggers on 2
well you have commented out the rest
atleast on your github repo
wait nvm
so, it adds the role correct?
Yeah
and before it adds it it console logs the id?
It doesn’t log anything
well in your code it logs the id before adding the role
console.log(muterole.id)
await wUser.addRole(muterole.id);```
it logged this543521259158372362
How do i make a bot have multiple prefixes? 😅
Multiple or custom?
DataBase


