#development

1 messages · Page 964 of 1

earnest phoenix
#

the heck

#
 const prefix = "!"
#

when i changed it to const prefix = '!' it told me that message was no defined

indigo notch
#

well ther eyou have it

#

define message

earnest phoenix
#

i dont know what that means

indigo notch
#

learn basic js

#

take some courses

earnest phoenix
#

ok

tame anvil
#

lol

digital ibex
#

hi

#

does why is guilds undefined? im trying to display the users guilds but its not showing them for some reason, it says cannot read property of 'forEach' of undefined and all it is is guilds.forEach , anyone know why that may be happening, when i do console.log(guilds) nothing responds, im probably not making much sense cuz ive been trying to fix this issue for ages

devout wagon
#

Mind showing the code

#

You can't just grab a variable guilds out of thin air

digital ibex
#

ik i can't

#

but user is not undefined, it shows my id, and i done the same thing i done for user to show my id with guilds to show my guilds, but its not undefined

#
   res.render('dashboard', {
      user: req.user, // my id
      guilds: req.guilds // undefined
   });
devout wagon
#

And what's req

digital ibex
#

request

devout wagon
#

Obviously but where does it come from

#

Can't you just send the full code

digital ibex
#

request comes from expressjs

#

the other code is irrelevant

#

but sure, ```js
const router = require('express').Router();

function auth(req, res, next) {
console.log(req.user); // logs my id - 475371795185139712
if (req.user) {
next();
console.log(${req.user} is logged in); // logs: 475371795185139712 is logged in
} else {
res.redirect('/login');
console.log(user is not loged in); // logs: user is not logged in
}
}

router.get('/', auth, (req, res) => {
console.log(req.guilds); // logs nothing
res.render('dashboard', {
user: req.user,
guilds: req.guilds
});
});

module.exports = router;

earnest phoenix
#

How i can make my display a [Object Map]

#

?

digital ibex
#

learning javascript can help

earnest phoenix
#

me ?

digital ibex
#

yes

earnest phoenix
#

no i mean

#

when i eval a function

#

it display me [Object map]

digital ibex
#

yes

earnest phoenix
#

for example this

#

but maybe it wont work

#

cuz it is 2000+ lines

digital ibex
#

can u learn javascript, u come here for the most simplest issues which u would kno if u kno the language

modest maple
earnest phoenix
#

@digital ibex dude i know the language

digital ibex
#

ok

earnest phoenix
#

-__-

quartz kindle
#

when you concatenate an object into a string, for example "bla" + object js does this for you: "bla" + object.toString()

#

but objects cannot be stringified like that, they need to be serialized

#

which means to go through the object and stringify each key and each value into json

#

so in order to display an object as text, you need to serialize it, using for example JSON.stringify()

#

node.js also offers util.inspect for serialization with some advanced functions and utilities

earnest phoenix
#

:0

#

nothing to say anymore

quartz kindle
#

note that discord.js collections are based on Maps not Objects, so they work differently

#

but util.inspect works on everything, so its better to use it instead of JSON

earnest phoenix
#

dose anyone know how to make a simple embed

random shuttle
#

Are you using discord.js

earnest phoenix
#

yes

digital ibex
#
message.channel.send({ embed: { /* data u want */ } })
earnest phoenix
#

ok

quartz kindle
#

or use their builtin embed builder

copper cradle
#

see, you didn't know the lang

earnest phoenix
#

How's possible to like slice an eval message into more messages?
For example if the eval message has more than 2000 characters show the first 2000 characters on the first message and it's other parts in different messages

grand dagger
#

yeah just send multiple messsges

#

messages*

#

Or paginate

pale vessel
#

use discord.js split option

#

but it would break the codeblock but i think you can also provide a codeblock option too so there's that

earnest phoenix
#

But use the split option where that's what I'm thinking about

pale vessel
#

.send(message, options)

earnest phoenix
#

Oh nice
Like
<Channel>.send(<message>, { split: true })?

pale vessel
#

yes

earnest phoenix
#

K

#

Nice

copper cradle
#

since when does d.js have a split option

pale vessel
#

not sure but i remember it being in v11

earnest phoenix
#

how do you set the bots status

devout wagon
#

by sending a status update via the websocket connection

earnest phoenix
devout wagon
#

If you use discord.js, this may be a more helpful answer

heady mortar
#

I've got two bots that are identical in every way except name, tag, client ID, client secret, and token. I'm testing a new command I wrote and one bot can use it perfectly fine while the other says that it lacks permissions. What could be the issue?

Both bots have identical roles, and use the exact same code.

#

I've tried both bots in several configurations on two different servers and it works out the same way every time. I am confident that there is no typo in the code itself since both are running from the same files.

sudden geyser
#

Are you running the command in the same space. What permission does it lack? What action are you trying to perform?

copper cradle
#

what are you trying to do

#

if one bot is trying to do something to the other bot then...

heady mortar
#

Yes I'm running the command in the same place. It doesn't tell me what permission it lacks, but I can tell it's "Manage Roles" since I'm trying to get it to add a role to me. The role it's trying to give me is below it in the hierarchy.

copper cradle
#

dude

#

if you're the owner of the server

#

then that won't work

#

bc nobody can do anything to the owner of the server

heady mortar
#

One of them gives me the role just fine. As long as the role it's trying to give me is below it, it can give it to me perfectly fine.

#

The bots are identical as far as I can tell and one of them works

copper cradle
#

hmmm

#

afaik that shouldn't work, but ig things have changed

prime glacier
#

message.guild.roles.size error undefined Roles same for emojis

dreamy current
#

@prime glacier .roles.cache.size

prime glacier
#

thanks

#

it works

placid vault
#

How i can get the role object and give it to {member}

role = self.bot.get_role(role_choice[0])
await self.bot.add_roles(member, role)
copper cradle
#

then don't

earnest phoenix
#

is there a way of deleting a message if it has a certain word

proven swan
#

what library

#

in djs v12 it would be like

#
client.on('message',async function(message){
  var bannedwords = ["put", "banned", "words", "here"];
  if(bannedwords.some(word => message.content.includes(word))) return message.delete();
});
earnest phoenix
#

thx

pale vessel
#

by the way, it's not case insensitive

copper cradle
#

@proven swan what do you mean what api

#

that's not what an api is lmao

proven swan
#

oops lol

wheat pumice
#

i think he meant what lmaguage lol

#

language*

proven swan
#

i meant library

quartz kindle
#

djs would be a library actually

earnest phoenix
#

lol

copper cradle
#

yeah

earnest phoenix
#

do you know the code to auto temp mute/mute/kick/temp ban/ban

copper cradle
#

yeah

open flicker
#

How to get user status? used to be member.presence.game.type == 0 and now how?

pale vessel
#

member.presence.status?

open flicker
#

game status

copper cradle
#

but I ain't spoon-feeding you

digital ibex
#

how do i get the ip of the users accessing my site?

copper cradle
#

CUSTOM_STATUS

#

@digital ibex cookies

digital ibex
#

oh

#

what do i do with the cookie?

quartz kindle
#

you dont need cookies for that?

copper cradle
#

idk

quartz kindle
#

that depends on your webserver

copper cradle
#

you could use them tho

wheat pumice
#

ye

radiant estuary
#

hello guys,
i need help with CSS. I have a div container with a button inside. How can i set that the button is alwasy at the and of the div?

copper cradle
#

but you can get the ip from the request iirc

earnest phoenix
#

How do you auto temp mute/mute/kick/temp ban/ban

copper cradle
#

think about the logic behind it

#

then write some code

#

then write some more code to fix your bugs

quartz kindle
#

@radiant estuary horizontally or vertically?

copper cradle
#

then cry bc the code you wrote only made things worse

quartz kindle
#

like always at the bottom or always left/right

radiant estuary
#

@radiant estuary horizontally or vertically?
@quartz kindle horizontally

quartz kindle
#

like always on the right?

radiant estuary
#

no, at the bottom. Sorry.

quartz kindle
#

ah then vertically

radiant estuary
#

yes

quartz kindle
#

you can use flexboxes, or absolute positioning i guess

#

its a bit tricky to do

#

you can also google "sticky footer"

#

its the same principle

radiant estuary
#

okay, thank you

open flicker
#

to get the game status do i need member.presence.activity.type?

dreamy current
#

member.user.presence ?

dark flint
#

@radiant estuary position: absolute; bottom: 0;

dreamy current
#

my bot @manic pagoda crash when getting the owner from this server

radiant estuary
#

thx

quartz kindle
#

guild owners are not guaranteed to be available

#

they need to be fetched

earnest phoenix
#

How do you auto temp mute/mute/kick/temp ban/ban

digital ibex
#

hi, does anyone know why im getting a syntax error? my code: js <% user.guilds.forEach(guild => { %> <%- include('dashboard/guilds') -%> <% }) %>

#

second line, the error: SyntaxError: Unexpected token ')'

#

im unsure why thats happening, using ejs

stuck scaffold
bitter sundial
lyric mountain
#

How do you auto temp mute/mute/kick/temp ban/ban
kick and ban are easy, just do member.kick or member.ban respectively

#

the others are a bit harder

digital ibex
#

oh

#

same error tonkku

quartz kindle
#

@stuck scaffold idk

bitter sundial
#

is it happening inside the include then

stuck scaffold
#

:/

quartz kindle
#

looks like debug information from an http2 connection

digital ibex
#

oh?

quartz kindle
#

how are you even getting that?

digital ibex
#

so theres something inside guild.ejs which is causing the error?

stuck scaffold
#

I do not do anything

bitter sundial
#

whats the full error output

earnest phoenix
#

@lyric mountain is there a way of doing it so if someone has done something multiple times it will kick them?

stuck scaffold
#

I moved the bot from x VDS to y VPS and this problem started to occur @quartz kindle

lyric mountain
#

@lyric mountain is there a way of doing it so if someone has done something multiple times it will kick them?
@earnest phoenix store the user in a database, each time they are warned increase the count in the db

#

once the value in the db reaches a certain count apply whatever punishment you want

quartz kindle
#

need more information, cant do anything with that

#

whats the full error?

earnest phoenix
#

ok

quartz kindle
#

@stuck scaffold the actual error is that your database file is missing

#

no, your database file

stuck scaffold
#

json.sqlite

quartz kindle
#

yes

stuck scaffold
#

ok

#

thx

quartz kindle
#

idk, but for now you can only fix the other errors

digital ibex
#

hi me again

#

without it showing the way it is

#

using css

quartz kindle
#

@stuck scaffold try running apt install fontconfig

stuck scaffold
#

dnf install fontconfig

#

worst

quartz kindle
#

show your package.json

stuck scaffold
#

@quartz kindle

quartz kindle
#

uninstall everything that you're not using

#

also uninstall os and fs, those are built into node

#

snekfetch, axios, superagent and node-superfetch all do the same thing, use only one

#

mongoose, mysql and quick.db are all databases and database frameworks, use only one

stuck scaffold
#

I don't use MySQL

#

I use quick.db for unnecessary data

lyric mountain
#

if it's unnecessary data, why keep it?

stuck scaffold
#

like some instant message ids

#

I clean once a day

copper cradle
#

dude what are you even doing...

#

remove those unused dependencies holy fuck

pale vessel
#

i only have 18

#

and my bot has like 200 commands

#

though i don't think that's a factor

lyric mountain
#

mine has 37 lol

sudden geyser
#

mine only has 10 but you could go to 0 if you want to internally suffer

quartz kindle
#

you're counting dependencies?

pale vessel
#

no, just copy package.json and see line count

quartz kindle
#

oh lul

open flicker
#
    let game
    if (!argsUser.user.presence.activity) game = `${message.language.get('user_game1')} **${statuses[argsUser.user.presence.status]}**`
    else if (argsUser.user.presence.activity.type == 'PLAYING') game = `${message.language.get('user_game2')} **${argsUser.presence.activity.name}**``` code
```TypeError: Cannot read property 'presence' of undefined``` error
why do i have a mistake?
quartz kindle
#

what is argsUser?

open flicker
quartz kindle
#

argsUser = member.user
argsUser.user = member.user.user

earnest phoenix
#

what library

quartz kindle
#

you just pinged someone lmao

earnest phoenix
#

include the embed in the MessageOptions

#
<channel>.send(`string`, { embed: embed });```
quartz kindle
#

you dont even have an embed?

earnest phoenix
#

..

#

make an embed

#

then implement the code i gave where ever you use <channel>.send()

pale vessel
#

how.

#

just add.

quartz kindle
#

@earnest phoenix ```js
.send("text content here", {options object here})

#

embed is an option

stuck scaffold
digital ibex
#

does anyone know any websites like bulma.io?

stuck scaffold
#

I deleted 26 modules flush

earnest phoenix
#

i cant get embeds to work?

stuck scaffold
golden condor
#

what was ping in eris again?
I can't see it in the docs

digital ibex
#

the same with d.js

#

although createdAt returns a timestamp not a date

golden condor
#

I mean like client.ping

digital ibex
#

to get the shards latency?

golden condor
#

Oh yeah

#

client.shard[shard number].ping

digital ibex
#

client.shards.get(shard id).latency

earnest phoenix
#

can someone help me. i don't understand embeds

stuck scaffold
#

I deleted the json.sqlite file and restarted the bot but again this error occurred @quartz kindle

lyric mountain
#

show where you've defined the file

stuck scaffold
#

require('quick.db') ?

lyric mountain
#

no

#

where you're getting the json.sqlite file

modest maple
#

json.sqlite

#

😫

golden condor
#

It's quick.db

stuck scaffold
#

^

lyric mountain
#

quick.db is the lib

digital ibex
#

hi, anyone here used bulma before?

golden condor
small prairie
#

Docs for voice recieving are really weird
How do i receive voice in d.js?

digital ibex
#

cuz im having a little bit of an issue, i got my website to display the users guilds, but now i want it to be split in half, not make a new line for each server

#

yes @golden condor

golden condor
#

I've never used it sorry

digital ibex
#

the black line is how i wanna split them up

small prairie
#

Wait weird
i am only able to recieve data whilke my bot is playing something
is it d.js lib bug or what/

earnest phoenix
#

how do i make an embed with a custom author,title and url?

golden condor
#

What lib

dusky marsh
#

something like this ? @digital ibex

#

i cant send it hold on

digital ibex
#

ye

pale vessel
#

flex

dusky marsh
#

in bulma it looks like you can have a column container with two nested column containers

#

and that should have the desired effect

digital ibex
#

what would the name of the class be

dusky marsh
#

columns for the parent container and column for the children

digital ibex
#

o ok, thanks :)

dusky marsh
#

ye

digital ibex
#

right

#

😄

#

thanks

earnest phoenix
#

how do i create an embed that has a custom Picture,title and url

dusky marsh
#

CxllmToday at 4:07 PM
What lib

quartz kindle
#

@earnest phoenix if you mean this part, you use the author field

earnest phoenix
#

i mean the 1st one

quartz kindle
#

use the author field

#

in discord.js its .setAuthor()

earnest phoenix
#

ok

#

thanks

quartz kindle
small prairie
#

um

#

how can i recieve audio d.js

#

the docs seems confusing

stuck scaffold
#

I deleted the json.sqlite file and restarted the bot but again this error occurred @quartz kindle

digital ibex
#

@dusky marsh sorry for the ping, how can i separate the columns?

#

using css if possible

dusky marsh
#

it should have it already according to the docs, but try putting .is-3 on .columns

digital ibex
lyric mountain
#

holy

dusky marsh
#

i would use the data and seperate it into two datasets, and apply either of the datasets to either of the columns

lyric mountain
#

that killed half my screen pixels lol

digital ibex
#

the blue is just there so i can see it better

#

wdym

#

confuso

dusky marsh
#

how are you adding the data to the columns now?

digital ibex
#

so like, i have a forEach function and thats filtering guilds into guild

#

and then its just guild.name

dusky marsh
#

yeah but how are you actually displaying that information on the page

digital ibex
#

frontend?

dusky marsh
#

it looks like youre just appending the data to .column

#

yes

digital ibex
#
<div class="container">
   <div class="columns">
      <div class="column">
        <p class="bd-notification"><%= guild.name %></p>
      </div>
      <div class="column">
        <p class="bd-notification"><%= guild.name %></p>
        <div class="columns is-mobile">
        </div>
      </div>
    </div>
</div>```
#

thats it, i only wanted to two bits

#

i am kinda new to web dev btw 😄

dusky marsh
#

i would make your guild information a list of guild names and then split that list in half, and apply dataset1 to the first column and dataset2 to the second column

stuck scaffold
#

how can I fix

digital ibex
#

how would i do the split bit?

earnest phoenix
#

is it possible to code a music bot? on discord.js

golden condor
#

Yes very possible

dusky marsh
digital ibex
#

oh, with js

#

oki, thanks :)

earnest phoenix
#

how can you make a music bot. i have been trying and i cant do it

digital ibex
#
        <p class="bd-notification"><%= (guild.length / 2).splice(o, (guild.length / 2))  %></p>
``` so  so like that?
golden condor
#

There is a discord.js guide

#

Are you using ejs?

digital ibex
#

ye

golden condor
#

It's quite useful I find

digital ibex
#

was planning to use vue, but i was having trouble interacting the frontend with the backend

#

yeah, its quite easy

earnest phoenix
#

how can i code a music bot

stuck scaffold
quartz kindle
#

dont you use quick.db? why do you have mongodb?

stuck scaffold
#

I use quick.db for unnecessary data

pale vessel
#

"unnecessary"

#

uses it anyway

lyric mountain
#

"unnecessary"
@pale vessel I've asked that already

stuck scaffold
#

like instant message id

pale vessel
#

lul

stuck scaffold
#

Erensi_28bugün saat 21:48
like some instant message ids
I clean once a day

#

I will delete quick.db soon

pale vessel
#

tm

agile oyster
#

im building my very first bot, im new, so if anybody could give me tips that would be helpful

pale vessel
#

do not use free hosts

lyric mountain
#

do not leave optimizations for later, they'll haunt u

#

do not create two clients, ever

digital ibex
#

@dusky marsh im confused

lyric mountain
#

your token MUST be hidden, and out of your code

#

json IS NOT a db

#

there are others

#

but I'd stay here the whole evening

stuck scaffold
#

MongoError: pool destroyed
how can I fix, please help me

pale vessel
#

don't destroy the pool :(

stuck scaffold
earnest phoenix
#

poor pool

#

how can i create a music bot

stuck scaffold
#

you think I'm doing this on purpose?

quartz kindle
#

so you use mongodb? do you have mongodb installed in your server or are you using a service like atlas?

earnest phoenix
#

how can i create a music bot
it is much much more complex than you think

#

oh

stuck scaffold
#

mongodb installed

#

this error did not happen before

quartz kindle
#

in your server?

#

not in npm

stuck scaffold
#

on the server

quartz kindle
#

how did you install it?

stuck scaffold
quartz kindle
#

how do you connect to it in your code?

stuck scaffold
#

mongoose.connect('mongodb://localhost:port/db')

quartz kindle
#

did you change port to your port number? did you create a database called db after installing mongodb?

stuck scaffold
#

yes

#

I imported the db data

quartz kindle
earnest phoenix
#

Does anybody know that the fetchAllMembers option can be the reason that the bot eats a lot of memory?

#

Currently and currently 227k users in the fetch... Fetching a lot

digital ibex
#

probably could be, i don't imagine it being a large amount tho

torn ravine
#

wait so to make a bot restart I would just make it relog?

earnest phoenix
#

I mean... 227k users

#

Wouldn't that take up a lot?

twilit rapids
#

That defaults to false

digital ibex
#

yeah, it shouldn't i don't think

twilit rapids
#

So unless you enabled it yourself it shouldn't do stuff

earnest phoenix
#

Timo you talking to me?

twilit rapids
#

Yes I am

earnest phoenix
#

I set it to true in the client options

twilit rapids
earnest phoenix
#

So should i turn it off?

digital ibex
twilit rapids
#

Yes

pure lion
#

how would i get all the roles in a guild (discord.js)

digital ibex
#

instead of: server 1 | server 1 server 2 | server 2 server 3 | server 3

#

with bulma or css

torn ravine
#

how would I make a command only execute for one user

pure lion
#

sorry, my all-seeing glasses broke and im too lazy to get up and stare into my magic mirror so please tell me what library you are using

torn ravine
#

shit sorry

#

discord.js

pure lion
#

ah yes

#

you do it like this

torn ravine
#

epic thanks

pure lion
#

maybe

#

most probably

#

can someone help me now please

quartz kindle
#

guild.roles contains the role manager

#

guild.roles.cache contains the collection of roles

pure lion
#

cache.find what parameters tho :/

quartz kindle
#

what do you want to find?

pure lion
#

all

quartz kindle
#

guild.roles.cache is all roles

pure lion
#

i dont need to use cache.find do i

#

skjbgkjshfgkjdh]

quartz kindle
#

.find is to get 1 specific role

pure lion
#

hahahahahha thx

whole shoal
#

Hi

earnest phoenix
#

how i detect links??

mossy vine
#

use a regular expression

earnest phoenix
#

like what?

mossy vine
#

google for "url regex"

earnest phoenix
#

ok

#

idk how use that

/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/```
summer torrent
#

String.match(regex)

earnest phoenix
#

why this dont work?

if(message){
let algo = message.content
let regex = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/
let matches = algo.match(regex)
console.log(matches)
  if(matches !== null){
    message.delete
  }
}
#

omg

#

i put message.delete without () xD

torn ravine
#

is bot.destory a function?

white anvil
#

no

amber fractal
#

yes it is

#

lmao

white anvil
#

destory

torn ravine
#

bot.destroy doesn't work

amber fractal
#

did you call it

#

or just do bot.destroy

#

and is your client variable called bot

torn ravine
#

trying to make a restart command

#

using bot.destroyt

amber fractal
#

show me the code for the command

torn ravine
#
            .then(bot.destroy())
            .then(bot.login(token))```
white anvil
#

bot.destroy does not return a promise

torn ravine
#

oh shit

amber fractal
#

you'll want to put them in the same one like .then(() => { bot.destroy() bot.login(token) })

torn ravine
#

epic it works

#

one more test

#

@amber fractal would you mind running wwrestart in #commands?

#

nvm

honest perch
earnest phoenix
#

Do you guys know any other way of checking if the user has nitro than animated avatar/common discriminators {common discriminators that nitro users use}/custom emoji in custom status?

agile oyster
#

HEllo, do you know How to run bot code without node.js, cause I can't install node.js, because im not on adminstrator side and its locked

summer torrent
#

you should be install node.js

#

if you want to code with js

agile oyster
#

Some guy said use visual studio code and also use node.js, but I sadly can't

torn ravine
#

I need to be allowed to execute the prefix permission without being the server owner

#

I use ``` if (!message.member.hasPermission('MANAGE_GUILD')) {

        return message.channel.send(fail1)
    }``` to deny all users exeept server manager
vernal rivet
#

Asking if you code without node.js is asking if you can live without air.

sudden geyser
#

You either await the promise and assign it to a variable, or attach a .then method to your promise. Then you send a message to the newly created channel

#

Such as myPromise().then((channel) => channel.send("hi"))

vernal rivet
#

^^^^

sudden geyser
#

The result of the promise is your channel

vernal rivet
#

you are calling on the channel that was created in the .then

earnest phoenix
#

Do you guys know any other way of checking if the user has nitro than animated avatar/common discriminators {common discriminators that nitro users use}/custom emoji in custom status?
Anyone?

#

Already did

vernal rivet
#

Docs is your best friend

earnest phoenix
#

I'm myself the docs

vernal rivet
#

If it's not there, then it's most likely not made yet

earnest phoenix
#

I mean... I read docs before doing anything

vernal rivet
#

That I know of, there is no exact way of checking if the user has nitro. The only way is based on the avatar If it is animated or not.

earnest phoenix
#

Did you even read what i check for

vernal rivet
#

I said the wrong thing

#

But it's the same thing. Both do not have any kind of methods that checks for you.

earnest phoenix
#

Ik they don't... But as i asked... Is there any other way of checking for them other than those 3

vernal rivet
#

No, if there is no exact way of checking if they have nitro, then you have to check if they can use, or has stuff that is only obtainable through nitro. You should be going based on avatars, as some custom emoji are global, meaning anyone can use them in any server, if they are in the server that it is originally from. Common discrim is hard to be exact, as some people could actually have that discrim without having nitro.

vague kite
#
    let channelID = "383326219866865667"

    return client.shard.broadcastEval(async() => {
      let channel = this.channels.cache.get(`${channelID}`);
      if(channel){
        channel.send("Hey")
      }
    });

Can someone help me? Whenever I try to pass channelID into broadcastEval it says channelID is not defined

earnest phoenix
#

There's a way more than thise that pedrokarim64 and larko uses but they don't tell anyone @vernal rivet

vernal rivet
#

I mean that's up to them on how they do it

#

Put the declaration of channel ID in the broardcastEval. @vague kite

earnest phoenix
#

They use the same way as mine... Just check for more things as I'm talking about them @vernal rivet

#

Well i think we'll never know lol

vernal rivet
#

Yea lol

vague kite
#

Well I wanna get it from DB but I need to declare it outside of broardcastEval

amber fractal
#

then you cant use it

lethal hawk
#

@earnest phoenix what library you use?

amber fractal
#

evals have their own scopes

vernal rivet
#

Yea

earnest phoenix
#

@lethal hawk discord.js

vernal rivet
#

You can't declare an object outside the scope it is being used in.

vague kite
#

Then how comes the guide shows that you can use args[0] in it??@amber fractal

#

Hope you don't mind the ping ❤️

amber fractal
#

what guide

vernal rivet
#

Because the object is a constant

amber fractal
#

no no, look

#

theirs is a string

#

you gave it a function

vernal rivet
#

Yes

lethal hawk
#

you could use member.premiumSince, that returns a date since when the uses boosts your server @earnest phoenix

earnest phoenix
#

@lethal hawk i check for that too

amber fractal
#

theirs uses template literals to do pass the variable as a string

lethal hawk
#

you would like to know if they have nitro, even when they are not boosting?

vague kite
#

Ohhh I'm stupid facepalm

amber fractal
#

¯_(ツ)_/¯

vague kite
#

Thank you ❤️

earnest phoenix
#

@lethal hawk I'm trying to know both of them... I go this way:
1- Checking for nitro:
Animated avatar/common denominator {common discriminators that nitro users use}/custom emoji in their custom status/if they boosted the server/if they boosted one of the servers my bot is in
2- checking for discord nitro booster:
If they boosted the server/if they boosted one of the servers that my bot is in

#

But it isn't perfect as sometimes it doesn't detect them... I'm trying to make it perfect by checking for more things

#

All this... Just to put those badges in their userinfo

lethal hawk
#

You could get that info directly from the discord api (bypass discord.js and make a get request), but that requires some special oauth that has to be done by your bot (with which I cannot further help you I am afraid)
You can take a look at these links: https://discord.com/developers/docs/resources/user#user-object-user-structure, https://support.discord.com/hc/en-us/community/posts/360032697192-Make-it-possible-for-bots-to-check-if-user-has-nitro-is-in-hypesquad-is-staff-etc-

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

earnest phoenix
#

@lethal hawk that's what i tried to do before checking for those... I have no idea how that would with a userinfo command which has literally no connection... No connection between them at all... So it's kinda not good to do that

#

i need help

#

for my bot

fiery hill
#

just a dumb question, does the native setTimeout's timer (not client#setTimeout) end if the bot goes down?

earnest phoenix
#

can anybody help pls

torn ravine
#

what's the one-liner to find amount of guilds?

earnest phoenix
#

can anybody help???

fiery hill
#

client.guilds.cache.size or client.guilds.size @torn ravine

lethal hawk
#

Do not ask to ask. Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem.

#

just a dumb question, does the native setTimeout's timer (not client#setTimeout) end if the bot goes down?
I am not sure, but you could set the timeout long enough and take the bot offline to see what happens?

fiery hill
#

yea i'll try that

#

well. gets cleared, now i have to write my own version, while stringify-ing functions cause of <JS>, yeee x)

amber fractal
#

wrong channel

#

your bot isnt even here

lyric mountain
#

I am not sure, but you could set the timeout long enough and take the bot offline to see what happens?
@lethal hawk it does

#

No single process can keep a timer running once shutdown

fiery hill
#

hmm. I'm trying to make a "mute" function tho, but since my bot usually goes down, i wanted the timer to not expire each time it does, do you have any simple idea of a way to do it?

lyric mountain
#

Use a database

amber fractal
#

you cant. Most mutes aren't exact

#

I set a timeout, but add it to a database so if the bot goes down it queries every 5 minutes to check if they should be unmuted

lyric mountain
#

Store the user id and the timestamp in the database

#

Each minute check for stored timestamp - current timestamp

#

If it's bigger than X, unmute

fiery hill
#

hmm that's what i was thinking about, yea could do it

torn ravine
#

what's the one-liner to check how many members?

lyric mountain
#

Just remember to use embedded databases like sqlite, because they're faster and allow constant transactions like this

#

@torn ravine guild.users.cache.length

modest maple
#

🤔

lyric mountain
#

If it's to get all cached members, client.users.cache.length

#

Note that idk how each thing is written in d.js, but you get the idea

wanton nova
#

its .size

#

since its a collection

fiery hill
#

yea

#

was typing to slow x)

lyric mountain
#

As I said, I'm no d.js dev, so idk

wanton nova
#

alright

torn ravine
#

k thanks

wanton nova
#

just wanted to let you know

lyric mountain
wanton nova
#

i really need to make an embed constructor for eris but im way too fricking lazy christmasthink

#

and i dont wanna google one up

#

but i hate how long it takes to make an embed

#

and i have to transfer all of my code from discord.js to eris

#

AAAAAAAAAAAAAAAAAAAAA

amber fractal
#

using a database

dawn trout
#

Hello

#

Can i ask?

#

Im new about coding

#

Hey

#

Blu

#

I do from our youtube

#

Umg

#

The Glitch

ancient lichen
#

i love json ;P

dawn trout
#

Can you help me more

lyric mountain
#

Anyone know how I can place a 24hr cooldown on a certain command?
@earnest phoenix you can have even 1 century of cooldown

dawn trout
#

@earnest phoenix Help me more

#

Please

#

i just got the ping

#

pong

lyric mountain
#

Because database based cooldown aren't running processes, but simple difference checking between two values

dawn trout
lyric mountain
#

Current timestamp - cooldown timestamp

#

Will give u the difference in millis between two timestamps

ancient lichen
#

If it's to get all cached members, client.users.cache.length
@lyric mountain sorry to bother, do you know any ways to get cached messages?

lyric mountain
#

Afaik you can't

slender thistle
#

Could also store the timestamp and then see if currentTimestamp is greater or equal

ancient lichen
#

hmmm...

lyric mountain
#

You gotta cache them yourself

ancient lichen
#

seems fair but i wont ;P

lyric mountain
#

Could also store the timestamp and then see if currentTimestamp is greater or equal
@slender thistle the minus way is more easier to visualize

slender thistle
#

catshrug to each their own

dawn trout
#

@earnest phoenix Your yt great

lyric mountain
#

@dawn trout you gotta understand what you're doing first

#

Learn ps basics, your language basics, etc

#

Programming is not that hard, but copying will certainly not teach u how to code

dawn trout
#

what is ps

#

Milliseconds?

wanton nova
#

86,400,000

#

simple google search can figure that out for you

dawn trout
#

8.64e+7

#

24hr = 8.64e+7 millisecond

slender thistle
#

1000*60*60*24

dawn trout
#

Ps is PostScript?

#

LoL

#

Hha

lyric mountain
#

what is ps
@dawn trout sorry, meant cs

#

Computer science

fiery stream
#

hey

#

whats the best rust wrapper?

#

for discord

lyric mountain
#

Rusteeze

fiery stream
#

thx

#

do you know where i can find the docs

lyric mountain
#

Lol jk, ask @queen violet, he might know one

fiery stream
#

serenity is most started

dawn trout
#

LoL

#

Cs is hard

queen violet
#

@fiery stream people usually use serenity

fiery stream
#

k cool

#

jvm

#

where can ifind docs

dawn trout
#

Cs is like a game coder

lyric mountain
#

Errr no

#

Cs is the basic to understand how programming works

queen violet
#

this domain has docs for most rust things

#

very useful

lyric mountain
#

And to prevent another botghost

fiery stream
#

thx jvm

fiery hill
#

Yay i did it was much simpler than what I thought it would be x)

#

(having a mute that doesn't expire when bot goes down)

lyric mountain
#

You're welcome

dawn trout
#

Can you help me about the commands

lyric mountain
#

By using a db you can use a lot of persistent features

dawn trout
#

in glitch

fiery hill
#

what for?

lyric mountain
#

Helping like what?

fiery hill
#

handling?

#

client.user.setActivity('for B!help and b!help' , {type: "WATCHING"})

#

you're welcome 😉

dawn trout
#

Hello

#

I want to put my status count onlines

#

can you help?

#

like

#

Playing 10294 Onlines !

#

I wanna put that

#

Im new

#

Im wanna learn about making bot

#

so i appear here

#

Noo

#

I mean

#

Count Online

#

like

#

other invite

#

and they will count

fiery hill
#

Online users ?

dawn trout
#

yes

#

I mean that

#

i do on glitch

fiery hill
#

Hmm you could use may be client.users.cache.size in the presence message.

dawn trout
#
bot.on("ready", () => {
  console.log("The bot is online!");
  bot.user
    .setActivity("Presence message here", {
      type: "PLAYING"
    })
    .catch(console.error);
});
#

Here

#

can you change

#

Put in the

#

(''B!help or b!help'')

#

bot.on("ready", () => {
console.log("The bot is online!");
bot.user
.setActivity("B!help or b!help", {
type: "PLAYING"
})
.catch(console.error);
});

#

Now i wanna count member

fiery hill
#

@earnest phoenix client.guilds.cache.size for server count

dawn trout
#

How about Member count

#

like onlines

fiery hill
#

I have to check smthing quickly

paper phoenix
#

like onlines
@dawn trout - For members online you'll need member/presence intents if over 100 servers.

dawn trout
#

I wanna put it in glitch

paper phoenix
#

For total members:

const total = bot.guilds.cache.reduce( ( total, { memberCount } ) => memberCount + total, 0 );
dawn trout
#

Can you change this one for me

#

bot.on("ready", () => { console.log("The bot is online!"); bot.user .setActivity("Coding", { type: "PLAYING" }) .catch(console.error); });

#
bot.on("ready", () => {
  console.log("The bot is online!");
  bot.user
    .setActivity("Coding", {
      type: "PLAYING"
    })
    .catch(console.error);
});
lyric mountain
#

No spoonfeeding plz

paper phoenix
#

I'm on mobile at work. Not ATM

lyric mountain
#

No

#

Spoonfeeding

dawn trout
#
const total = bot.guilds.cache.reduce( ( total, { memberCount } ) => memberCount + total, 0 );
#

Where do i put

#

im using Glitch

#

i use glitch idk where to put

#

xD

#

Im a Huge Noob

fiery hill
#

client.users.cache.reduce((total, user) => user.presence.status === 'online' ? total + 1 : total) i believe, or does cache only get users that sent messages after the bot was added ?

forest pond
#

Which Do I Use JavaScript Or Go? Hmmm

lyric mountain
#

Or java

forest pond
#

Ugh I’ll Use JavaScript But I Need Learning Lessons

lyric mountain
#

Google ftw

forest pond
#

Ok

#

Thank

lyric mountain
#

That's because you're giving two arguments to a single argument function

slender thistle
#

Yeah

#

It's a kwarg, not positional

#

Refer to the BaseActivity enum

earnest phoenix
#

Ik this is not a usual thing but does anybody know why the downvote count of posts fetched from reddit are always 0?...

dawn trout
#

Hello

#

Guys

#

Anybody use Glitch to build a bot?

sudden geyser
#

Yeah some

dawn trout
#

Can you help me

#

make a command handler

sudden geyser
#

In what means. What do you want it to do? Do you know anything about the fs module?

plush helm
#

Hey, can you help?

#

My bot in my server isn't working

#

@sudden geyser sorry for ping

sudden geyser
#

Do you know why it's not working?

plush helm
#

No

#

I gave it all the perms

#

It stopped working suddenly

#

So???

sudden geyser
#

I can't infer what went wrong just by that info. Do you own/develop the bot or is it someone else's bot.

dawn trout
#

i want to do the +help and it dm

#

show commands

#

and make commands work

earnest phoenix
#

So as i was testing some debugging and stuff... I installed puppeteer-core as it needs a browser to be installed through npm install... But i tried installing some browsers through it and still says could not find a browser... What can cause this issue?
Or do i need to install a specific browser?

#

If anybody knows that used puppeteer

sacred wraith
#

Just do a npm i puppeteer. It installs the browser automatically.

earnest phoenix
#

How do I see how many bots I have in my server?
Js

sudden geyser
#

What library.

earnest phoenix
#

@sacred wraith but then it says failed to launch the browser process

#

js

sudden geyser
#

The library, not the language.

earnest phoenix
#

discord.js

sudden geyser
#

Eris, Discord.js, etc.

#

ah then just filter the <Guild>.members.cache collection and check if the user is a .bot

earnest phoenix
#

?

#

<guild>.members.cache.filter(m => m.user.bot).size

sudden geyser
#

no spoon

earnest phoenix
#

Don't direct to that places for such a simple thing

sudden geyser
#

Why not? You'll find everything you need there.

earnest phoenix
#

ok

#

my filter was wrong

#

@sudden geyser i mean... He can but he can also learn by that

#

Most people get confused on reading the docs

sacred wraith
#

Reading the docs is a good skill to acquire.

sudden geyser
#

It's good to get experienced in browsing documentation. You'll need it for almost everything :^)

earnest phoenix
#

Yea that's a thing that beginners can't achieve @sacred wraith

#

That's the main issue

pale vessel
#

even for puppeteer :^)

sudden geyser
#

if a beginner can't achieve it there's only one way to learn

pale vessel
#

show me your launch options dank

sacred wraith
#

Are you sure you've installed puppeteer and not puppeteer-core? Because the latter does not come with a browser.

earnest phoenix
#

@pale vessel this is what i tested


 

(async () => {

  const browser = await puppeteer.launch({ignoreDefaultArgs: ['--disable-extensions']});

  const page = await browser.newPage();

  await page.goto('https://example.com');

  await page.screenshot({path: 'example.png'});

 

  await browser.close();

})();```
pale vessel
#

you wouldn't want to ignore default args

#

well, the browser won't open anyway so that's not the issue i guess

#

did you install chrome?

earnest phoenix
#

@sacred wraith i tried both... One can't find a browser even if i installed it... And one can't launch the browser

#

@pale vessel what's the exact package name?

pale vessel
#

what do you mean?

earnest phoenix
#

Don't you say did you install chrome?

pale vessel
#

did you get any errors while installing puppeteer

#

nah, sorry, it comes with one

earnest phoenix
#

I didn't

pale vessel
#

what is the actual error that you got

earnest phoenix
#

For the puppeteer:
can't launch the browser process!

pale vessel
#

oh

earnest phoenix
#

And for puppeteer-core:

#

can't find a browser, use "npm install" or "yarn install" to install a browser

pale vessel
#

obviously

#

do you know how to define args?

earnest phoenix
#

args in what?

pale vessel
#

launch options

earnest phoenix
#

I have no idea

pale vessel
#

you might need to disable sandbox

#

anyway, remove ignoredefaultargs and read docs on how to define args and disable sandbox

earnest phoenix
#

K lemme try

vale garden
#

hi

#
module.exports = {
  name: 'random',
  description: 'random number generator',
  execute(message, args) {
    let a = args[0];
    let b = args[1];

    if (!args[0] || !args[1])
    return.message.channel.send("Enter the minimum and maximum value of the random number generator like this for example: t!random 1 10");

    message.channel.send(Math.floor(Math.random() * a + b));
  
  }
}
#

this is a command from v11

#

what do i change in it for v12

pale vessel
#

how did this even work in v11

vale garden
#

it did

#

idk how

#

wait

#

no

#

this is not it

#

wait nvm

#

anyways how do i do it

#

lol

#

can someone just tell me how to make a normal random no. generator in v12

dawn trout
#

Hello Guys

#

Can you help me make a command handlers

pale vessel
#

look in your code @vale garden

vale garden
#

yeah?

pale vessel
#

do you not see return.message

vale garden
#

i do

pale vessel
#

that's not how-

vale garden
#

so wdym

pale vessel
#

it's return message

vale garden
#

i removed it and got NaN

#

ohh

pale vessel
#

a space, not a period

#

you didn't even tell us the error

vale garden
#

ok

#

yeah

#

i forgot

#

now this is happening

#
module.exports = {
  name: 'random',
  description: 'random number generator',
  execute(message, args) {
    let a = args[0];
    let b = args[1];


    if (!args[0] || !args[1])
    return message.channel.send("Enter the minimum and maximum value of the random number generator like this for example: t!random 1 10");
   
    message.channel.send(Math.floor(Math.random() + a * b));
  
  }
}
pale vessel
#

console log a and b

vale garden
#

im sorry im bad at coding

#

what

#

    return console.log('yoo the args came in')
    return message.channel.send("Enter the minimum and maximum value of the random number generator like this for example: t!random 1 10");
   
    message.channel.send(Math.floor(Math.random() + a * b));
  
  }```
#

is the logging right

pale vessel
#

no

#

just add console.log(a) to the code

#

or just console.log(args)

vale garden
#

not logging

#
    return message.channel.send("Enter the minimum and maximum value of the random number generator like this for example: t!random 1 10");
#

i feel really dumb rn

#

is it correct

#

cuz i feel like it isnt

earnest phoenix
#

anyone down to help me with getting json data from an api

#

im confused asf

stark compass
#

i need some help. im really new to this but i need a bot that pins messages every time certain phrases are said is that possible?

#

and can i merge the function into an existing bot?

#

or maybe jsut add reactions to them

turbid bough
#

You mean like redbot?

#

That add stars then pins it to a channel

stark compass
#

can i configure it?

turbid bough
#

Think so

#

@earnest phoenix stop

stark compass
#

please

#

can you shoot me a link

#

@earnest phoenix gently leave

slender thistle
#

Be nice

stark compass
#

apologies

turbid bough
stark compass
#

thanks, just wanna make sure i get the right thing

turbid bough
#

Then read and check if it is the right thing

stark compass
#

ok ima be honest thats kind of a "female dog" to do i made a simpe bot today that links chat from my mc server to a discord channel is there any way to just configure the feature into it?

#

actually im tired af ill check back in tomorrow

torn ravine
#

i want to make my guild count apart of my status. but I can't because the string registers as text

oak cliff
#

Put it inside of ` not '

torn ravine
#

works thanks

dawn trout
#

Hello

#

Im Using Glitch do make a bot

#

Im Newbie

#

How can i count the members

restive furnace
#

since you use glitch, i think you use discord.js, not your own neither Eris.

queen needle
#
 if (message.content.startsWith(prefix + "ss")) {
        var app = require("node-server-screenshot");
        app.fromURL("https://google.com", "test.png", function() {});
        message.channel.send("no u", {
          files: ["test.png"]
        });
      }``` so im trying to create a screenshot command and i keep getting the error no file directory exist app/test.png
restive furnace
#

because the file needs to exists

dawn trout
#

Hey Sir

restive furnace
#

or then simply stream it into discord

#

Hey Sir
?

queen needle
#

im not trying to send app/test.png though

dawn trout
#

@restive furnace

#

I mean

#

That

#

Can you help me do a setActivity

#

of

#

Count Member

#

i cant see

restive furnace
#

read the docs, or go read these tutorials

#

i sent abovee

#

im not trying to send app/test.png though
some hosters just add app/file.format

queen needle
#

if i try to send app/test.png i get app/app/test.png

restive furnace
#

yep

dawn trout
#
exports.run = (client, message, [mention, ...reason]) => {
  const modRole = message.guild.roles.find(role => role.name === "Mods");
  if (!modRole)
    return console.log("The Mods role does not exist");

  if (!message.member.roles.has(modRole.id))
    return message.reply("You can't use this command.");

  if (message.mentions.members.size === 0)
    return message.reply("Please mention a user to kick");

  if (!message.guild.me.hasPermission("KICK_MEMBERS"))
    return message.reply("");

  const kickMember = message.mentions.members.first();

  kickMember.kick(reason.join(" ")).then(member => {
    message.reply(`${member.user.username} was succesfully kicked.`);
  });
};
restive furnace
#

its bcs the where you host the bot

dawn trout
#

Where is prefix

#

Sir

#

I wanna change prefix

queen needle
#

so its just a problem with my hosting?

#

like i cant really fix it

restive furnace
#

so its just a problem with my hosting?
Most likely

dawn trout
#

@restive furnace Seems like i know you

restive furnace
#

you can switch hosters tho

stuck scaffold
dawn trout
#

Are you Hero that host a GTPS

#

@restive furnace

#

Hmm

#

I remember you

restive furnace
dawn trout
#

@restive furnace Are you is that guy name Hero?

restive furnace
#

Keep this channel in-topic...

dawn trout
#

Ohh Ok

#

I wanna change the prefix to +

#

But idk where

#

Im NEw

restive furnace
dawn trout
#

I wanna host self bot

golden condor
#

No you don't

#

Do you wanna self host a bot?

#

Is that what you mean?

dawn trout
#

Yes

golden condor
#

Good

dawn trout
#

The free bot hosting is boring

golden condor
#

Self bots are bad and against ToS

dawn trout
#

Not the bot that in your account

golden condor
#

Well can you keep your computer on 24/7?

dawn trout
#

Its a discord bot

#

If Self Bot : Required Vps

restive furnace
#

If Self Bot : Required Vps
@dawn trout nah, its just illegal

dawn trout
#

ik

#

But the one i mean was

#

Discord Bot

golden condor
#

You can buy a vps or you can host on your computer if you can keep your computer up 24/7

dawn trout
#

Nah

#

too hard

restive furnace
#

or buy raspbi like my friend did

golden condor
#

^

dawn trout
#

Nowadays my pc haveing a problem

#

so i dont want download

#

My bot reasonly ded

hallow lance
#

What raspbi should i buy?

#

@restive furnace got any idea?

dawn trout
#

Can you help me make help like

#

when you do +help

#

it dm you

#

and

#

show command

copper cradle
#

@hallow lance Raspi 4

hallow lance
#

Wrong server@dawn trout

#

@hallow lance Raspi 4
@copper cradle dang 100euros...

dawn trout
#

😦

copper cradle
#

well yes it's kinda expensive

hallow lance
#

what if i'd buy a a older one

copper cradle
#

idk

#

just get a vps

#

like

#

you can get better than a raspi 4 for $3

#

for example

#

contabo offers 100Mbps internet + lik 200GB SSD and 8GB RAM for like $5

#

lemme check real quick

hallow lance
#

dang

#

But i mean a raspberry, one time purchase.

fast trench
#

can someone help me get my webhook setup over in #topgg-api

copper cradle
#

This is what they offer

contabo offers 100Mbps internet + like 200GB SSD and 8GB RAM for like $5

#

they have even better plans

hallow lance
#

That's good

copper cradle
#

and all that for $5 a month

hallow lance
#

I mean a year you pay how much, $600

copper cradle
#

5 * 12

hallow lance
#

wait bruh my math

fast trench
#

?

restive furnace
#

raspbi 3 has 1.5 GB ram, so if its enough then go for it

#

60

hallow lance
#

i found 2GB for 50$

copper cradle
#

$60 per year

hallow lance
#

my math

#

bruh

copper cradle
#

lmao

fast trench
#

...

hallow lance
#

today is not my day

copper cradle
#

normal puns make me go numb
but math puns make me go number

hallow lance
#

what if id buy raspbi zero

#

lmao

dawn trout
#

Hello

#

GUys

copper cradle
#

what

dawn trout
#

Can you check out my setup

hallow lance
#

Wydm setup

copper cradle
#

^

restive furnace
#

if u mean bot code, try it and see

copper cradle
#

now they're gonna flex on us

dawn trout
#

No

#

i mean

#

Hard

#

But

#

can you enter

#

here

copper cradle
#

no

restive furnace
#

dont

#

taok

#

like

#

this

hallow lance
#

i have a $200 computer with like $80 gear

restive furnace
#

iits annoying

copper cradle
#

don't send an invite, you'll get fucked

restive furnace
#

youre allowed to send invites for coding servers i think

#

where you can receive help better

dawn trout
#

Where is coding server

hallow lance
#

What do you mean coding server.

dawn trout
#

Can you get give me a link

hallow lance
#

What library you use?

restive furnace
#

like discord developers?

dawn trout
#

Glitch