#development

1 messages ยท Page 345 of 1

warm canopy
#

const channel = guild.channels.first().permissionFor(guild.me); it says the first one it finds that has the perms

#

I think

#

I dont have join messages

earnest phoenix
#

It returns a list of permissions

vital lark
#

mhm

earnest phoenix
#

But then-

#

How would I then

warm canopy
#
   const channel = guild.channels.find(c=> c.permissionsFor(guild.me).has("SEND_MESSAGES"));```
earnest phoenix
#

Ill try that

#

I wouldnt need the second .has() statement then

warm canopy
#

Ye

#

test it

earnest phoenix
#

YES

#

IT WORKS

#

Ohmygodthankyou

#

I have been trying to do that for a while

earnest phoenix
#

Hey guys?

#

How do I make custom VCS errors that end the process

#

Or well

#

How can I end the process from within the code

sinful meadow
#

process.exit(1);

#

Not joking

earnest phoenix
#

Okay lol

#

Lmao

#

Thx!

sinful meadow
#

Np

earnest phoenix
#

@earnest phoenix Again, we aren't google

#

how about you actually try, and google it yourself

#

Boi, whenever I google something

#

It comes up random form threads

#

That literally arent helpful in the slightest

#

I do try :/

sinful meadow
#

@earnest phoenix just ignore him thats why this channel exsist to help people

#

not be a fucking douche and say Look it up

earnest phoenix
#

๐Ÿ‘Œ

#

@sinful meadow tbh this is simple shit, we don't need to spoonfeed everything

rich kiln
#

mayo

earnest phoenix
#

what Yes?

rich kiln
#

if ur not here to help, just go away.

earnest phoenix
sinful meadow
#

Thanks @rich kiln Like no joke

earnest phoenix
rich kiln
#

@earnest phoenix next time check nodejs docs

earnest phoenix
rich kiln
#

@PassTheMayo#1281 just

#

stop

earnest phoenix
#

Hahah

#

nice ping

#

and no

#

@rich kiln

#

Wait

#

There are node.js docs?!

#

OML

#

Thank you for telling me this lol

#

@earnest phoenix plz stop

rich kiln
#

@sinful meadow cancerous ppl are like this

earnest phoenix
#

kthx

#

;-;

sinful meadow
#

@rich kiln yep

earnest phoenix
#

Thx

#

๐Ÿ˜‰

rich kiln
#

@The Darkness Soldier#1418 also use mdn

earnest phoenix
#

ยฏ_(ใƒ„)_/ยฏ

#

@rich kiln I do

#

MDN is <3

#

w3 is shit

rich kiln
#

we actuaLly dont care

#

if it helps its useful.

topaz fjord
#
const snekfetch = require('snekfetch');
const Discord = require('discord.js')

module.exports = async(bot, guild) => {
    const channel = bot.channels.get('364584124540911619');
    const embed = new Discord.RichEmbed()
      .setAuthor("Lost Guild", bot.user.avatarURL)
      .setColor("RANDOM")
      .setTimestamp()
      .setDescription(`**I have left:** ${guild.name}\n**Owned by:** ${guild.owner.user.tag}\n**With:** ${guild.memberCount} members!`);
    channel.send({embed});
}
#

anyone have an idea

#
DiscordAPIError: Missing Access
    at item.request.gen.end (C:\Users\Sid\Desktop\BobBot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:71:65)
    at then (C:\Users\Sid\Desktop\BobBot\node_modules\discord.js\node_modules\snekfetch\src\index.js:217:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)```
prime cliff
#

I dont think you can get the member count and/or owner when its left

#

Not sure you have to test

thorny hinge
#

You can

topaz fjord
#

it wont send the message to the channel

prime cliff
#

Well its missing access to one of the variables thats why

thorny hinge
#

I have my own lil version of that

prime cliff
#

@topaz fjord debug your code to see which variable is failing

thorny hinge
#
//sexy embed goes here
//client.channels.get("my awesome join-leave logs id").send({embed});
});
``` ![mmLol](https://cdn.discordapp.com/emojis/356831697385422848.webp?size=128 "mmLol")
topaz fjord
#

idk for some reason it works outside of function handler but not inside

earnest phoenix
#

@topaz fjord DiscordAPIError: Missing Access

#

the bot doesn't have permission to send to that channel

#

doesn't have anything to do with variables

topaz fjord
#

the channel id

#

is from my personal server

earnest phoenix
#

ok

#

what about it

topaz fjord
#

and im making the bot leave a testing server

#

and on the personal server the bot has the highest role

earnest phoenix
#

still no permission

#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

Hey guys?

prime cliff
#

Hey guys?

earnest phoenix
#

Lol hello person

#

I have a question

prime cliff
#

Lol hello person

#

I have a question

sinful meadow
#

What? @earnest phoenix

prime cliff
#

Yea what is your question?

earnest phoenix
#

Okay hold on

prime cliff
#

Loading Windows 1997....

earnest phoenix
#

I just want to know how to fetch a channel from a guild

#

Using an ID

#

Similer to fetchMember

prime cliff
#

Which lib?

earnest phoenix
#

d.js

prime cliff
#

Have you read the docs?

earnest phoenix
#

Yes, but I do not know how to refrence it

topaz fjord
#

message.guild.channels.find('id', 'ID HERE');

#

pretty sure thats how it works

earnest phoenix
#

Oh

sinful meadow
#

client.channels.get()

#

^^^^^ amazing

earnest phoenix
#

Okay!

#

Well thank you

topaz fjord
#

but thats through all servers boi @sinful meadow

#

wait

#

shot

#

shit

sinful meadow
#

No shit xD

earnest phoenix
#

Wait

prime cliff
#

all servers?

topaz fjord
#

yes

prime cliff
#

Dont you mean channels

topaz fjord
#

look through all the servers to find a channel that has that id

earnest phoenix
#

message.guild.channels.get("ID");

sinful meadow
#

^^^^^^^

earnest phoenix
#

How would I then reference said channel?

#

message.guild.channels.find("name", "channel name")

sinful meadow
#

message.channel

earnest phoenix
#

๐Ÿ‘Œ

#

^

#

My home server

#

Wow

#

Okay

#

Wait

#

?

#

Im trying to get messages from every guild

#

And send them somewhere

#

So

#

How would

sinful meadow
#

That would be api abuse

earnest phoenix
#

Wait

#

Wot

#

api abuse

#

dont

#

๐Ÿ‘Œ

#

cough cough DB logging

#

deletes entire code

#

Okay well thank you for telling me that

#

Lol

#

Hey guys?

sinful meadow
#

Hi @earnest phoenix

earnest phoenix
#

no

#

Hi!

#

no

#

?

sinful meadow
#

Yes @earnest phoenix

earnest phoenix
#

I has a question

#

If your up for answering it

sinful meadow
#

Sure

earnest phoenix
#

Okay so

#

For process.exit(integer)

#

How would I make a delay

sinful meadow
#

setTimeout()

earnest phoenix
#

๐Ÿ‘Œ Thx!

#

Like this?

#
exit.setTimeout(2000);
sinful meadow
#

nope

earnest phoenix
#

Exit is a var

#

Oh

#

Rip

#

Okay from the MDN docs

#

It says Ill need to create a function

#

Okay thank you ill try to work at this ๐Ÿ˜ƒ

#

Wait

#

How do I reference the base studio?

#

Hm

sinful meadow
#

?????

earnest phoenix
#

Like

#

In the MDN

#

It uses window

#

But

#

This isnt a website

#

Lemme put it like this

#

The object that the code is run on

#

So I suppose node Thonk

#
let exit;

function exitProcess() {
    exit = node.setTimeout(exitProcessMain, 2000)
}
function exitProcessMain() {
    process.exit(1);
}
client.on("message", (message) => {
    if (message.content === '---shutdown' && message.author.id === '376147022660632587') {
        exitProcess()
    } else if (message.content === '---shutdown' && !message.author.id === '376147022660632587') {
        message.channel.send('Only the bot owner may use this command!')
    }
});
#

According to the docs this should work

#

Nvm

#

Node isnt defined

#

Maybe I need a variable defining node

#
const node = new Node.Client;
#

Trial and error

#

I have done it!

naive stag
#

Anyone know how you can send Clyde-style pm's within a channel ?

#

Like, "This message is only visible by you - Delete this message?" thing

fervent goblet
#

You can't

#

Thats not an api feature

naive stag
#

ah rip I thought so

fervent goblet
#

Would be cool tho

#

Just use dms for now

quiet bobcat
#

How do I create a role with discord.js? And when I have created the role how do I edit it?

tawny lava
quiet bobcat
#

Oh. Didn't even see that. Lol thanks!

restive silo
#

wait until the Promise resolves and then get the resolved Message object and edit it

#

use .then() or async/await

uncut slate
#

await or gtfo

fervent goblet
#

lol

vital lark
#

Were awaiting to gtfo

languid dragon
#

Is it

(statement === true) ? true : false

OR

(statement === true) ? false : true
sinful meadow
#

dont know

restive silo
#

its true then false

#

also

#

you can short that up

languid dragon
#

i know

#

it was for example

restive silo
#

oh kk

languid dragon
#

ty โค

ornate shadow
#

is client.users.size accurate? it doesn't seem to show the right number of users

#

I mean it displays 4.5k users while this server alone has over 6k

sinful meadow
#

That is the whole bot together @ornate shadow

thorny hinge
#

client.users.size returns the size of all the cached users

ornate shadow
#

?

#

oh?

#

how can I update that then?

thorny hinge
#

Idk

ornate shadow
#

xD

sinful meadow
#

you cant

ornate shadow
#

damn

sinful meadow
#

It updates by itself

thorny hinge
#

classic cache

ornate shadow
#

rofl

sinful meadow
#

No

#

Ew

ornate shadow
#

so I guess there's no other way to display the actual member size

#

user*

#

and gotta stick with that

sinful meadow
#

Of the whole bot

#

Or server

ornate shadow
#

the bot ofc

sinful meadow
#

Yea idk a way

ornate shadow
#

basically I wanna get the sum of all the users of all the servers the bot is currently in

sinful meadow
#

Oh the servers you can do

#

client.guilds.size

ornate shadow
#

the users of the servers xD

sinful meadow
#

^^^^^^ That is the real number of servers

ornate shadow
#

The bot currently loves ${bot.users.size} users, in ${bot.channels.size} channels of ${bot.guilds.size} guilds.

#

this is my string

#

xD

sinful meadow
#

That looks fine

ornate shadow
#

well it's inaccurate though :-<

sinful meadow
#

That isnt our fault

#

That is d.js

ornate shadow
#

xD

#

so I just gotta deal with it and move on

sinful meadow
#

Yep

ornate shadow
#

well thx for cutting my research time I guess ๐Ÿ˜„

sinful meadow
#

Or i mean

#

you can do something like this

ornate shadow
#

loop through servers and add the users of guilds?

sinful meadow
#
let shite = 0;
client.guilds.forEach(e =>{
shite = e.members.size + e.members.size
})
#

dont know

#

that probs wont work

ornate shadow
#

xD

sinful meadow
#

i just threw it together

ornate shadow
#

yeah idk either

sinful meadow
#

i can test it

ornate shadow
#

but it will surely use more computing power than the standard innacurate one (we have no guarantee it will work either)

earnest phoenix
#

x d

shrewd field
#

How do I make a command that sends a dm to all members of all the guilds the bot is in. Don't worry I won't use it I just want to know the code.

#

I can't seem to figure it out.

sinful meadow
#

Anything related with api abuse we wont help @shrewd field

#

Simple as that

lethal sun
#

^

thorny hinge
#

Why do you want the code if you won't use it ๐Ÿค”

umbral pelican
sinful meadow
#

Lmfao @umbral pelican your emoji made it 10x better

#

hahhahaha

umbral pelican
#

lol

abstract mango
#

whoops wrong channel

neat falcon
#

two questions:

how do i lock commands to upvoters/supporters only
how do i add multilanguage to a bot

i use discord.js and snekfetch

#

^if you answer them please ping me

sinful meadow
#

@neat falcon

#

Do you really want to lock a command?

#

@neat falcon You can use my amazing code ```js
snekfetch.get(https://discordbots.org/api/bots/${client.user.id}/votes)
.set('Authorization',TOKENFUCKER).then(e => {
let test = e.body.find(post => post.id === message.author.id)
if(!test){

  }else{


  }

});

neat falcon
#

thanks

#

what about patreon?

sinful meadow
#

Np

#

idk

neat falcon
#

hmm

sinful meadow
#

i dont think patreon has an api

neat falcon
#

inb4 i lock all music commands on @prime wharf and @crude ginkgo :^)

sinful meadow
#

idrc

#

Its not my bot not my problem

karmic lake
sinful meadow
#

ik @karmic lake

neat falcon
#

inb4 luca is locked to upvotes

sinful meadow
#

It had my token thats why i changed it @karmic lake

restive silo
#

Does anybody know if Lavaplayer export his Version Number somewhere eyesLeft

earnest phoenix
#

Lol

earnest phoenix
#

Hey guys

#

Im getting an EventEmitter memory leak error ;-;

#

How would I go about fixing it?

#

I tried what it said to do but it said emitter wasnt defined

quiet bobcat
#

What did it say?

#

And what's the code for it

earnest phoenix
restive silo
#

thats custom

quiet bobcat
#

How do you even do that?

royal pelican
restive silo
#

^ dont use that

#

it fucks your registry

wooden shoal
#

anybody know how to get atom-discord working?

restive silo
#

@quiet bobcat ^

quiet bobcat
#

Thanks

#

@restive silo How do I turn it on?

shy rose
#

@wooden shoal looking at some of the issues open for that owner says they connect through the rpc server but at no point did i get asked to authorise an rpc app so im guessing owner hasent actually shared the rpc invite and thats why everyone saying it doesnt work

wooden shoal
#

yep I saw that too.. thats annoying

shy rose
#

70 downloads and 4 open issues those arent good stats

#

with all issues saying the same thing in various ways

wooden shoal
#

yep.. And I'm pretty sure he isnt even going to try any further

shy rose
#

time to make a fork ๐Ÿ˜›

wooden shoal
#

lol

shy rose
#

would make a fork if i knew anything about rpc or atom extensions...

wooden shoal
#

btw I would too but idk anything about how to make them

#

and then actually getting the discord rich presence working

shy rose
#

the rich presens is just normal presense just with more flags

#

does atom maybe have a debugger to see if anything made errors :/

wooden shoal
#

Not sure...

#

But I looked over the code and I couldn't find any obvious errors

shy rose
#

guess ill just check the electron console

wooden shoal
#

oh ya

#

lol

#

maybe this is killing everything else

#

?

shy rose
wooden shoal
#

um

shy rose
#

nah thats fine

wooden shoal
#

what

#

is that his id?

shy rose
#

that fatal is fine ish

wooden shoal
#

k

shy rose
#

im willing to vouch thats his id

wooden shoal
#

lol

#

well

#

likely

shy rose
#

ill change it and try

shrewd field
#

Hwy

#

Hey

wooden shoal
#

how tf is it going to automatically change to our ids

#

shouldt it need our token tho

shrewd field
#

What happens if u share your id

wooden shoal
#

nothing

#

ur id is this

#

324920582665928727

shy rose
#

everyone can see it anyway

wooden shoal
#

lol

shrewd field
#

Ok

wooden shoal
#

k time to fix his code

shy rose
#

oh crap no my sensitive id that everyone can see i shared it ๐Ÿ˜›

wooden shoal
#

:lenny:

shy rose
#

i cant tell if it making atom slower or not :/

#

got to many addons

wooden shoal
#

I have lots too

shy rose
#

normal boot opens sits on grey fan clocks up goes into notreponding about 3 times then finally opens you see code goes not responding then gets hylighted code

wooden shoal
#

oh lol

shy rose
#

i think its teeling me ive got to many addons nah probably not

wooden shoal
#

I bet you his token is in the code somewhere

shy rose
#

you dont need the token to authorise an rpc request

#

just use that to get a bears token

wooden shoal
#

k

wooden shoal
#

k

#

idek what he was ding tbh

#

clearly did not want us to install it through atom

#

but from where should I install it :/

shy rose
#

same thing

wooden shoal
#

hm?

shy rose
wooden shoal
#

yes it is...

#

what would I put as the redirect url

#

lol idek what that is

#

oh

#

im stupid

#

nvm

shy rose
#

well idk that id isnt registered to an rpc app so....

wooden shoal
#

hm

#

seems to just be broken

shy rose
#

yup

wooden shoal
#

btw, do you ever install some npm package but it doesnt actually put it in teh folder

#

because im trying to npm install electron-packager --save-dev but nothing shows up in teh folder

#

the*

shy rose
#

the node_modules folder?

wooden shoal
#

nothing is added to the main folder

shy rose
#

where did you run the command in the folder?

wooden shoal
#

ya I ran it in teh folder

#

the*

shy rose
#

what it say in console?

wooden shoal
#

Do I need to git-init it?

#

why tf is there discord.js errors?

shy rose
#

says it installed?

wooden shoal
#

well it looks like it

earnest phoenix
#

npm install

wooden shoal
#

thats what I did..

shy rose
#

you shure your in the same file in cmd as you have open?

wooden shoal
#

100%

shy rose
#

i didnt even know that was a thing ๐Ÿ˜›

sick tide
wooden shoal
#

shift+right click

shy rose
#

ok do npm init then

wooden shoal
#

k

shy rose
#

i just get open powershell window here :/

wooden shoal
#

lol gg

#

ok thanks

sinful meadow
#

what os? @wooden shoal

wooden shoal
#

diddnt know I needed a package.json

#

naw its ok now

#

im just retarted

shy rose
#

you shouldnt normally it will more often than not work without

wooden shoal
#

odd

shy rose
#

i mean i says a few errors but other than that it works

wooden shoal
#

it always has errors for me lol

shy rose
#

other than the fatals it fine

wooden shoal
#

tru

shy rose
#

everything is good except for the bad things

wooden shoal
#

i mean every time I install some npm thing for my bot it works

#

yep

shy rose
#

is the folder under a parent npm folder?

wooden shoal
#

hm?

shy rose
#

as may have installed to parent folder if so

sick tide
#

@bitter sundial can you help me with something?

rich kiln
#

@sick tide this isnt a bott suport server

sick tide
#

This is the server i only found in the website of the bot

wooden shoal
#

wait

#

so

#

fam

#

this is a discord for people who make the bots

shy rose
#

ye

wooden shoal
#

we dont know nything about that one

#

ill look at teh creator tho

rich kiln
#

also
this is a "channel for chatting about bot development"

sick tide
#

oh fuck this

rich kiln
#

npt bot support

wooden shoal
#

doesnt even look like teh bot is in here

shy rose
#

i dont see that bot on luca

wooden shoal
#

whatever this isnt suport anyways

shy rose
#

why would you point your bots support server to here like no one here but the dev will have ever heard of that bot...

wooden shoal
#

ya idk

#

mayeb they changed the name of it in their guild

#

idk

shy rose
#

only a few bots here people know but not like the full list...

wooden shoal
#

ya

shy rose
wooden shoal
#

yeah...

#

โ•ฒโŽโงน **noice **โงธโŽ โ•ฑ

shy rose
#

i think a few are having connection issues it keeps going upand down by about 3

wooden shoal
#

:lenny:

#

well probably

misty crater
#

I'm wondering if there's a way to change the playing status of a bot. I'm using Discord.Net on btw.

wooden shoal
#

um I know there is with discord.js, and .py, and tons of others, but idk about discord.net

misty crater
#

aw rip

wooden shoal
#

actually

#
Game g = new Game("Lemon Party", GameType.Default,"Gamename");
disClient.SetGame(g);
``` If you run this after initialising your client, then the internet says it should work
misty crater
#

i'll try

wooden shoal
misty crater
#

?

wooden shoal
#

like is there a function that runs once the bot has connected

misty crater
#

i can make that happen yes

wooden shoal
#

ok put this code in that

misty crater
#

right

earnest phoenix
#

wat is the best bot for protecting a server from a deranged mod mass kicking/banning?

languid dragon
#

Uh

#

Dont hire shit mods

pale light
#

lol

#

anyone know about attaching files using discord.js photoblobs

earnest phoenix
#

anyone want to help me with something?

#

nevermind

strange lintel
#

Cant you inspect

earnest phoenix
#

is not an image

strange lintel
#

Thonk

#

What is it

earnest phoenix
#

i dont know

strange lintel
#

I just have it sending a png file

earnest phoenix
#

its best to link directly to the file

low niche
strange lintel
#

The image loads for me

earnest phoenix
#

weird

strange lintel
#

What do you mean its best to link directly to the file

earnest phoenix
#

nevermind

strange lintel
#

You cant just do that

#

In flask

#

You gotta make a view

low niche
#

I want Kot here but offline

earnest phoenix
#

can you send me the file? like, send the image here

#

not the link

strange lintel
#

@app.route("/header.png")
def headerimg():
    return send_from_directory("/qwerty/app/static","header.png")```
#

And ok

earnest phoenix
#

also, try removing Css data-react-helmet="true"
from the meta tags

strange lintel
#

K

earnest phoenix
#

my uploader might serve the file differently or something

#

embed pls

strange lintel
#

Done

#

Dang

#

Maybe the image is just too large?

earnest phoenix
#

fuck

#

hey

#

cool

#

cool

#

rippy kitty

strange lintel
#

YESSSSS

#

That one must be cached still

#

The problem was

earnest phoenix
#

nice

strange lintel
#

The image was too big

#

It was 1050 pixels

#

By 1050

earnest phoenix
#

lol

#

YUGE

#

HOLY MOTHER OF GOD COW YAY

lethal sun
#

chill

woven drum
#

mmlol

earnest phoenix
#

oh

quiet bobcat
earnest phoenix
#

Uhm how do I get the unicode code of 1โƒฃ 2โƒฃ and 3โƒฃ emoji's?

quiet bobcat
#

Turn on dev mode

#

Or unicode Thonk

earnest phoenix
#

dev mode is already on

#

\1โƒฃ

#

\:one: does that

quiet bobcat
#

Yes but to make the bot write it you need to copy the id

#

And do <1โƒฃ383929327386886145>

#

Think that should do it

earnest phoenix
#

ohh?

tawny lava
#

built in discord emojis don't have ids

quiet bobcat
#

Oh yeah thats right

#

But thats how to do it for custom emojis

earnest phoenix
#

ah yeah

quiet bobcat
#

So just do "1โƒฃ"

earnest phoenix
#

I'm looking for the built-ins

#

oh okay

quiet bobcat
#

As simple as that

earnest phoenix
#

"Unknown emoji"

quiet bobcat
#

What

#

message.channel.send(":one:") that sends a one

#

and then change it

#

to whatever

#

How do I make so if the bot uptime is more than 60 minutes it turns into an hour?

#

So like if(bot.uptime = 60000) {}

#

How do I make it so if its more than 60000 ms

#

it turns into hours

thorny hinge
#

> ๐Ÿ‘€

quiet bobcat
#

oh

#

im not so smart

#

lol

thorny hinge
#

And you don't use = in an if statement

#

=== is ideal

quiet bobcat
#

Oke

#

But if(bot.uptime === >60000) isnt valid?

thorny hinge
#

What are you trying to do lmao

#

With the === and >

quiet bobcat
#

Idk

#

I dont know how to use greater than

thorny hinge
#

Well there's no need for any =

quiet bobcat
#

is it if(bot.uptime > 60000)

thorny hinge
#

What you probably need is greater than or equal

#

=

quiet bobcat
#

Oke

thorny hinge
#

if(bot.uptime >= 60000)

quiet bobcat
#

Is there any way to do hours and minutes?

thorny hinge
#

division

quiet bobcat
#

Wat

#

If I do Math.round I will get a round number (duh) but how do I make it so it splits into two

thorny hinge
quiet bobcat
#

And not just eg 3.22 hours

thorny hinge
#

You have to divide

quiet bobcat
#

How?

#

This is spoonfeeding at its very best

thorny hinge
#

Isn't that simple math thonkku

quiet bobcat
#

No

#

I cant code

#

and I cant do math

thorny hinge
#

Rip

quiet bobcat
#

How do I divide it?!

fervent goblet
#

lol

quiet bobcat
#

This is what I got so far Math.round(bot.uptime / 600000)

thorny hinge
#

There are 3600000 in an hour so

quiet bobcat
#

idk why its 600000

thorny hinge
#

Math.round(bot.uptime / 3600000)

#

Will give you hours

quiet bobcat
#

But thats only hours

#

How do I get the minutes in between

#

So like 2 hours and 24 minutes

thorny hinge
#

60000ms in a minute

quiet bobcat
#

I know

#

But you cant do Math.round(bot.uptime / 3600000) and Math.round(bot.uptime / 60000)

thorny hinge
#

You can

quiet bobcat
#

Yes you can

#

But then you get 2 hours and 120 minutes

#

And that makes no sense

thorny hinge
#

You have to do some subtraction then

#

More math

quiet bobcat
#

What am I even supposed to subtract ๐Ÿ˜ฆ

#

Why do I start projects like these

thorny hinge
#

You have to find out how many minutes are in those hours

#

Then subtract that

#

From the minutes thing

quiet bobcat
#

What

#

So like Math.round(bot.uptime / 3600000) and Math.round(bot.uptime / 60000) and then Math.round(bot.uptime - Math.round(bot.uptime / 60000))?

#

That doesnt look valid

thorny hinge
#

Math.round(bot.uptime / 60000 - bot.uptime / 3600000 * 60)

#

Will be your minutes

#

ez math GWsecretLenny

quiet bobcat
#

oke

weak parrot
#

Why do I start projects like these tbh it's only good you do the more you learn now the easier it'll to add more stuff like this later on also helps you understand coding in your current lang a lot more

quiet bobcat
#

Yeah but I dont understand anything ๐Ÿ˜„

#

Thank you atmg

weak parrot
#

Everyone starts somewhere xD

quiet bobcat
#

Yeah I guess

#

How do I make so if it's under an hour it will post the minutes one and if its over an hour it will post hours and minutes?

thorny hinge
#

is over

#

< is under

quiet bobcat
#

Yes

#

I know that ```javascript
if(bot.uptime >= 60000)then =>(addField("Uptime:", Math.round(bot.uptime / 3600000) + " hours and " + Math.round(bot.uptime / 60000 - bot.uptime / 3600000 * 60) + " minutes"))

    if(bot.uptime <= 60000)then =>(addField("Uptime:", Math.round(bot.uptime / 60000) + " minutes"))```
#

I got those

#

But I dont know how to use then ๐Ÿ˜„

#

If I remove then, then it just says that addField is undefined

supple shale
#

...

#

oooor

quiet bobcat
#

What?

quiet bobcat
#

I made it work kind of. I now get the problem that it changes to hours after a couple of minutes

wooden shoal
#

@shy rose the atom thing works now!

#

he put out an update last night that fixed it

earnest phoenix
#

fuck, buidlding electron packages is hard

fervent goblet
#

?

earnest phoenix
#

Does anyone know how to delete a users ID from a json file database?

shy rose
#

Yay that's awesome

wooden shoal
#

ikr

warm canopy
#

Wolfie.js I wouldn't use json if your bot uses multiple servers

sinful meadow
#

What doge said ^^^^^

#

@earnest phoenix if you plan on using any sort of simple db use sqlite

earnest phoenix
#

Ah, alright man. I'll look into sqlite.

sinful meadow
#

Its stable

#

Fast and good

#

Well for small bots its good

#

Or storing simple things

earnest phoenix
#

I mean, I use json databases for my warn, level, custom guild prefixs, and soon for an afk command.

sinful meadow
#

Use sqlite for that

earnest phoenix
#

Alright.

quiet bobcat
#

How do I cap a value at 60. I did math round to get minutes, and I want to cap them at 60 so they dont go over to like 120 ect

inner jewel
#

if(value > 60) value = 60

quiet bobcat
#

That doesnt work @inner jewel , I cant use if in a .addField

inner jewel
#

value > 60 ? 60 : value

quiet bobcat
#

Ill try that

#

thanks

#

I dont know what I did but it removed hours

#

I had hours and minutes

earnest phoenix
#
 <i class="fa fa-clipboard" onclick="document.execCommand('copy')" aria-hidden="true"></i>
#

not working thonk

#

also this doesn't work either

#
          <i class="fa fa-clipboard" id="toggle" style="cursor: pointer;" onclick="copy()" aria-hidden="$
#
function copy() {
  var copyText = document.getElementById("message");
  console.log(copyText);
  copyText.select();
  document.execCommand("Copy");
}
#

help?

sinful meadow
#

What are you trying to do @earnest phoenix

quiet bobcat
#

Is there any way to get the same effect as message.mentions.members.first(); without using mentions?

sinful meadow
#

yes @quiet bobcat

#

get the first mention

#

replace the <@> with nothing then use the id to do something

quiet bobcat
#

But like if I do eg !kick @quiet bobcat is there any way to make so I only need to do !kick

#

or to add or remove roles

#

bc I need to define member

sinful meadow
#

That would make no sense

quiet bobcat
#

But idk what to define it as

sinful meadow
#

You cant do !kick and kick someone

#

You have to get a member

#

then kick

quiet bobcat
#

Ok bad example

#

Lets take luca for example

sinful meadow
#

You mean name fetch

quiet bobcat
#

His -nsfw command

#

I want to understand how it works

sinful meadow
#

That is probs stored inside of a database on who is hidden and who isnt hidden

quiet bobcat
#

bc it has member defined and its not based on mentions

sinful meadow
#

Then to message.member

#

xD

quiet bobcat
#

So I should define member as message.member GWcfcThonk

sinful meadow
#

this is how it works

#

message.author is the user
message.member is a guild object of author is another wise know as member

umbral pelican
#

omg what have I just read

quiet bobcat
#

Idk what you have read

#

Something sad

sinful meadow
#

You dont make sense @quiet bobcat

quiet bobcat
#

I know

sinful meadow
#

Please read apon the docs

quiet bobcat
#

Im trying but I dont understand anything

sinful meadow
#

That isnt a good sign

quiet bobcat
#

I know

umbral pelican
#

if message member has role > gib the role else take it

sinful meadow
#

^^^^^^

quiet bobcat
#

Yeah

#

But to give or remove roles I need to define members

sinful meadow
#

Nope

quiet bobcat
#

You dont?

sinful meadow
#

message.member is already a guild object

umbral pelican
#

guild object, wut

sinful meadow
#

It is @umbral pelican

#

its a guild Member object :p

umbral pelican
#

GuildMember object != Guild object

sinful meadow
#

lel

#

You knew what i was talking about

quiet bobcat
#

How do I remove a single message?

#

Thats a dumb question

sinful meadow
#

message.delete();

#

;p

quiet bobcat
#

Oke

umbral pelican
#

it's almost like d.js doesn't have really friggin easy docs to read

quiet bobcat
#

Thanks

#

I cant read those docs

#

I dont understand them

umbral pelican
#

then you should probably give up, they're the easiest docs you'll come across

quiet bobcat
#

Yeah

#

Ik

#

But I'll try to learn them

sinful meadow
#

@quiet bobcat lets start

#

Objects have some data inside them

quiet bobcat
#

Yes

sinful meadow
#

like name id content etc

#

Which is normally members ^^^^^^

quiet bobcat
#

yeah

topaz fjord
sinful meadow
#

use fs @topaz fjord

#

and requireCache

topaz fjord
#

like i have command handler that loads all my commands but i want to modify it so i can load commands in folder

#

s

#
fs.readdir("./cmds/", (err, files) => {
    if (err) console.error(err);

    let jsfiles = files.filter(f => f.split(".").pop() === "js");
    if (jsfiles.length <= 0) {
        console.log("No commands to load!");
        return;
    }

    console.log(`Loading ${jsfiles.length} commands!`);

    jsfiles.forEach((f, i) => {
        delete require.cache[require.resolve(`./cmds/${f}`)]
        let props = require(`./cmds/${f}`);
        console.log(`${i + 1}: ${f} loaded!`.green)
        bot.commands.set(props.help.name, props);
    });
});
pale light
topaz fjord
#

idk how go into each folder

#

anyone?

pale light
#

you want to load commands into folders?

bitter sundial
#

I believe readdir returns folders too

#

so you could get the folders with readdir and then for each one of those do readdir again to get the command files

topaz fjord
#

no i want to load to commands from the folders @pale light

pale light
#

ah

#

I see

topaz fjord
#

but idk

#

how

bitter sundial
#

I just explained

topaz fjord
#

oh wait i see it now

#

k

topaz fjord
#
fs.readdir("./cmds/", (err, files) => {

})
#

[ 'Fun', 'Moderation', 'Music', 'Utility' ]

#

Ive tried this

   fs. readdir(`${files[0]}/`, (err, files) => {
        console.log(files)
    })
#

but i get undefined

bitter sundial
#

add the ./ before files

quiet bobcat
#

How do I make so / is only one decimal? Lang is nodejs

crystal void
#

Sorry for this...

#

Hey @here, @gritty dirge is finally back with us again! @earnest phoenix let us use his server to host it ๐Ÿ™ƒ Thank you Emma! โค https://discordbots.org/bot/373542693453824010

bitter sundial
#

@crystal void you cant tag here lul

quiet bobcat
#

๐Ÿ˜„

bitter sundial
#

@quiet bobcat what do you mean

crystal void
#

I know...

#

I just pasted that from my server ๐Ÿ˜›

quiet bobcat
#

I want to see uptime but I'm currently using math.round

#

And it rounds up after half an hour

#

I dont want that

#

I want it to show one decimal

#

Like 2.6 hours

#

Instead of 3

compact cairn
#

Any good online hosts?

quasi marsh
#

Get a VPS

quiet bobcat
#

Yeah VPS are the only good hosts

quasi marsh
#

People tend to recommend VPSDime and Vultr alot here

#

DO is fine but expensive

compact cairn
#

Mk

quasi marsh
#

Scaleway is cheap for a lot of RAM but CPU performanc is lacking

bitter sundial
#

@quiet bobcat .toFixed(1)

quiet bobcat
#

So Math.toFixed(1)?

#

And then the math?

bitter sundial
#

Number.toFixed

quiet bobcat
#

?

compact cairn
#

Anyone wanna build a bot with meh?

#

More like I host it

quiet bobcat
#

So eg Math(bot.uptime / 3600000).toFixed(1)?

bitter sundial
#

let number = 725.8291938
number.toFixed(1) // '725.8'

quiet bobcat
#

ok thanks

bitter sundial
#

actually now that I think of that it might not round

#

like 725.86 would give the same result

#

but idk if that matters for your uptime lol

topaz fjord
#
fs.readdir("./cmds1/", (err, files) => {
    files.forEach((cmd) => {
        console.log(cmd)
        fs.readdir(`./cmds1/${cmd}/`, (err, files) => {
            let jsfiles = files.filter(f => f.split(".").pop() === "js");
            if (jsfiles.length <= 0) {
                console.log("No commands to load!");
                return;
            }
            console.log(`Loading ${jsfiles.length} commands!`);

            jsfiles.forEach((f, i) => {
                let props = require(`./cmds1/${cmd}/${f}`);
                console.log(`${i + 1}: ${f} loaded!`.green)
                bot.commands.set(props.help.name, props);
                delete require.cache[require.resolve(`./cmds1/${cmd}/${f}`)]
            });
        })
    })
})
#

i did this and it works

compact cairn
#

sigh

warm canopy
#

Are selfbots allowed anymore?

quasi marsh
#

In short, maybe, maybe not, wouldn't wanna find out

warm canopy
#

xD

#

Automating normal user accounts (generally called "self-bots") outside of the OAuth2/bot API is forbidden, and can result in an account termination if found.

#

there is my answer

warm canopy
#

I think

pale light
#

idk whats the error

compact cairn
#

LINE 1: const Discord = require('discord.js');
LINE 2: const boy = new Discord.Client();

LINE 3: bot.login('MyToken');

#

Why doesn't it do anything when I do node .

umbral pelican
#

because you called it boy ?

compact cairn
#

o

#

Im fucking stupid

#

Still doesn't work

#

LINE 1: const Discord = require('discord.js');
LINE 2: const bot = new Discord.Client();

LINE 3: bot.login('MyToken');

#

Is the new code

#

๐Ÿ˜

sinful meadow
#

That is from functions.js btw ^^^^^

compact cairn
#

`const Discord = require('discord.js');
const bot = new Discord.Client();

bot.on('message', (message)) ; {

if(message.content == 'ping') {
    message.reply('pong');
}

}

bot.login('Token');`

#

Wuts my error?

earnest phoenix
#
function showModal() {
    modal = document.getElementById("modal");
    modal.className += ("is-active");
}
function hideModal() {
    modal = document.getElementById("modal");
    modal.className -= ("is-active");
}
</script>
<div id="upload">
<form method="post" enctype="multipart/form-data">
<p><input type=file name="file" multiple>
<input type=submit value="Upload">
</form>
</div>
<div class="modal" id="modal">
<div class="modal-background"></div>
<div class="modal-content">
{% with messages = get_flashed_messages() %}
    {% if messages %}
        {% for message in messages %}
          <i class="fa fa-copy" id="toggle" style="cursor: pointer; float: right; font-size: large;" onclick="copy()" aria-hidden="true"></i>
          <strong>SUCCESS!</strong> {{ message }}
        {% endfor %}
    {% endif %}
{% endwith %}
</div>
<button class="modal-close is-large" aria-label="close" onclick="hideModal()"></button>
</div>
<div id="snackbar"></div>
#

the <button class="modal-close is-large" aria-label="close" onclick="hideModal()"></button> doesn't close

#

the thingy

karmic lake
#

'the thingy'

earnest phoenix
#

yup

#

is -= in js

karmic lake
#

im tryna work on other stuff rn

#

ill help in a bit

earnest phoenix
#
function showModal() {
    modal = document.getElementById("modal");
    modal.className += ("is-active");
}
function hideModal() {
    console.log('Hiding Modal');
    modal = document.getElementById("modal");
    modal.className -= ("is-active");
}
``` showModal works but hideModal doesn't
#

ok

#

rubs back

compact cairn
#

`const Discord = require('discord.js');
const bot = new Discord.Client();

bot.on('message', (message)) => {

if(message.content == 'ping') {
    message.reply('pong');
}

}

bot.login('MyTokenWuzHere');`

#

Idk wuts wrong with it

#

Visual studio gives me this error

prime cliff
#

@compact cairn I already DMed you help

#

Or did you block me?

compact cairn
#

Thanks

warm canopy
#

My question is.

#

why you define it as boy

#

Did you asume your bot's gender or did you simply make a typo

abstract mango
#

@compact cairn I saw something wrong

#

there was a extra parentheses

#

(message))

inner jewel
#

^

naive stag
#

How can I test for a @mention in a string taken from a message sent by a user?
@naive stag : @dense quiver
the thing on the left is the string extracted from my message saying: @naive stag, and the string on the right is .mention() ran on my IUser account. They don't match, how can I get something that will match without trimming the ! coz that seems like a pretty bad solution tbh

prime cliff
#

The ! means the bot has a nickname set

naive stag
#

the... user has a nickname set on the guild? or, the bot has a nickname in the guild?

#

Cuz the bot has a nickname but not the user, i dont see why the bot having a nickname should affect the @mention string for a user that isnt nicknamed

languid dragon
#

what library are you using

naive stag
#

discord4j

languid dragon
#

you want to see if both mentions match?

naive stag
#

i just want an easy way to turn @naive stag from a message from a user into the users IUser object, so I'm just looping through the guild's user list and trying if (user.mention().equals(string)), where string is the thing the user typed

languid dragon
#

you got me lost lmao ยฏ_(ใƒ„)_/ยฏ

naive stag
#

but as you can see that dosent work coz it has a ! in the mention string that the bot generates for some reason

#

yea my explanation wasnt great lol Thonk

languid dragon
#

if <@!> and <@> is an issue

#

use regex to remove them from the string and just test ID's

naive stag
#

I guess ill just do that

earnest phoenix
#

;-;

neon pasture
#

Can someone explain to me what .guildShardMap does, talking about Eris. (Object mapping guild IDs to shard IDs)

umbral pelican
#

"Object mapping guild IDs to shard IDs" that says what it does hyperThonk

neon pasture
#

Yeah, what means mapping...

vital lark
#

@umbral pelican discord.js looking ass nah jk bb

umbral pelican
#

an object with all guild ids along with the shard they're on

cosmic plover
#

correlating @neon pasture

#

lets say u have guild 27462727457 and 30 shards

#

well if that guild falls into shard 20

#

it will return an object like

#

guild id -> shard id

#

in this case it would correlate that guild id into shard 20

#

you can do that manually too if you want

#

there's a formula to get the shard of a guild

neon pasture
#

Thank you

earnest phoenix
#

Who Can Help me with .js Help Command on My Robot Does Not Work

short siren
#
const request = require('request-promise-native');
function postServerCount() {
    return request.post({
        uri: `https://discordbots.org/api/bots/${bot.user.id}/stats`,
        headers: {
            Authorization: "token in here", // Insert token here
        },
        json: true,
        body: {
            server_count: bot.guilds.size,
        },
    });
}``` why didint this work
topaz fjord
#

shit

sinful meadow
topaz fjord
#

why not just use snekfetch

#

i also have a quick question

sinful meadow
#

Sup @topaz fjord

topaz fjord
#

tb!tag add <tag name>

#

how would i be able

#

to get args[1] and on?

sinful meadow
#

The first can be an arg and the second would be a slice

topaz fjord
#

ok

#

ty

short siren
#

i forgot to put it in ready event ...

#

it works now

lethal sun
#

@earnest phoenix robot? um theres a difffrence between a robot and a bot

#

its not the same sir

compact cairn
#

`const commando = require('discord.js-commando');
const bot = new commando.Client();

bot.registry.registerGroup('random', 'Random');
bot.registry.registry.registerDefaults();
bot.registry.registerCommandsIn(__dirname + "/commands");

bot.login('TOKEN');
`

topaz fjord
#

um

compact cairn
#

O O F

#

U saw nothing

topaz fjord
#

u shoud change that

umbral pelican
compact cairn
#

Shit

#

Fuck me

#

Let me change it

topaz fjord
#

wut about that code

compact cairn
#

Mk

#

So when I run it

#

it gives me this

umbral pelican
topaz fjord
#

yup

compact cairn
#

I changed it

#

Already

#

B

#

Soooooooooooooooooooooooooo

umbral pelican
#

registry.registry feelsDarxMan

compact cairn
#

o o f

#

Thx

#

M7

#

m8

topaz fjord
#

idk how to use commando

compact cairn
#

Oml

#

FUCK

topaz fjord
#

readdddd

compact cairn
#

Dude

#

Im a fucking noob

#

How I do dis

#

lol

earnest phoenix
#

It's very simple

compact cairn
#

I need the )

#

But where

earnest phoenix
#

It's missing a )

#

It tells you

compact cairn
#

After argument list

#

?

earnest phoenix
#

Last stack trace

thorny hinge
#

@compact cairn pls use proper codeblocks too

earnest phoenix
#

I^

compact cairn
#

wut

umbral pelican
#

whats wrong with these

earnest phoenix
#

oops

compact cairn
#

idk

earnest phoenix
#

@earnest phoenix

thorny hinge
#
console.log("these are way better");
earnest phoenix
#

Kek

umbral pelican
#

can we ban mayo yet

thorny hinge
#

yes

earnest phoenix
#

oof

thorny hinge
umbral pelican
compact cairn
#

When it says ',' expected. for my error

#

Do I just replace it with a ,

#

๐Ÿ˜ฎ

#

fixed it

midnight crown
#

y'all make bots?

compact cairn
#

o o f

#

We try

midnight crown
#

Cool

compact cairn
#

ye

#

Here

#

DMS

vital lark
#

ban all commando users

compact cairn
#

why tho

#

๐Ÿ˜ฆ

#

message.reply("You rolled a " + roll,"!"); Why does it leave out meh "!"

midnight crown
#

I'm new to here so forgive me if i mess up

thorny hinge
#

@compact cairn string literals pls

vital lark
#

it's ```js
message.reply(You rolled a ${roll}!);

thorny hinge
#

^

#

The "something " + "kdkdjs" + whatever is bullcrap

#

String literals bae

compact cairn
#

lol

umbral pelican
#
message.reply(`You rolled a spliff!`);