#development

1 messages · Page 557 of 1

faint cedar
#

1 sec

slim heart
#

second of all, please take some simple js classes. because none of that is propper like at all

faint cedar
#

For got the de-

#

I'm trying to deobfuscate the code to make it up to standard

slim heart
#

well. what are you trying to actually do

#

instead of telling me you want to fix unintelligible code with no goal

faint cedar
#

Well, there are some calls for a.p but the only reference to the property of a.p is there..

#

The code currently doesnt work. My friend has the original code and hes being a dick

slim heart
#

um so uh. that's not a goal, nor an error, nor makes any sense. google js please triggered

faint cedar
#

Its not that I don't know JS. It's that I have never used it in a browser environment, and this is one of those cases that old code styles doesn't help me out.

slim heart
#

well no matter where you do it and no matter what version it is you shouldnt defining something as an argument in a function so uh i have a feelin ur trollin lol.

faint cedar
#

Trust me, I have a feeling that I am being trolled, though I am just trying to fix this and get it over with.

slim heart
#

well

#

ignore the code you've been given

#

and tell me what you're trying to do

#

and then we work from there

faint cedar
#

I'm gonna take my time and either figure out what broke or just end up rewriting it as I mostly know what was wrote.

keen drift
#

Uglified/minified code are hard to look at, may take time

#

You prob have better luck of just asking for the src code or try to replicate the behavior, minified code will give you a headache

amber fractal
#

It's also good to use real names for functions or vars

faint cedar
#

Yeah, lesson learned. Don't ask snobby friends for help.

amber fractal
#

Readability is amazing.

keen drift
#

readability doesn't really matter in production

faint cedar
#

@amber fractal Thats what Ive been doing, just been doing F2 in visual code to rename things as I remember what they do

keen drift
#

Webpack has plugins to uglify or minify to reduce production payload size, never meant to be used for debugging, unless there's a src map

faint cedar
#

Yuk^

keen drift
#

I separate my bundles to vendor pkg and the actual app

faint cedar
#

@keen drift Do you have something similar in your pack? ```js
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
value: "Module"
}), Object.defineProperty(t, "__esModule", {
value: !0
})

keen drift
#

Yes most likely

faint cedar
#

Just asking because I know this is webpack, but what it does is all I know its loading modules (obv.)

keen drift
#

is there only one bundle file

#

Webpack also have a plugin responsible to transpiling to browser supported js

faint cedar
#

Theres two JS files, the first one seems like it just pushes css to the page and body form.

#

The second one is the one i was trying to decode.

keen drift
#

if it looks like a bunch of garbo, with no human context info, like familiar strings, prob looking at wrong one

faint cedar
#

Lets just go with that Eslint doesnt want to mess with it.

keen drift
#

Yeah no, that's prob not the main app logic

#

looks more like webpack setting things up

faint cedar
#

Yeah this thing is filled with immediately executed functions.

amber fractal
keen drift
#

Perhaps, look at the bottom portions

#

how big is the bundle file anyway

silver lintel
#

so ive got this event, and it only works in my server. not another server. i tested by putting a channel with the name in another server and it doesn't work. heres my code:

bot.on("guildMemberAdd", async member => {
    let welcomeChannel = member.guild.channels.find(name => name.name === "welcome-goodbyes");
  if (!welcomeChannel) welcomeChannel = member.guild.channels.find(name => name.name === "welcome-goodbye");
    if (!welcomeChannel) welcomeChannel = member.guild.channels.find(name => name.name === "welcome");
  if (!welcomeChannel) welcomeChannel = member.guild.channels.find(name => name.name === "joiners");
  if (!welcomeChannel) welcomeChannel = member.guild.channels.find(name => name.name === "audit-log");
  if (!welcomeChannel) welcomeChannel = member.guild.channels.find(name => name.name === "general");
  let wc2 = member.guild.channels.find(name => name.name === "audit-logs");
  if (!wc2) return;
  if (!welcomeChannel) return;
  
  const embed = new Discord.RichEmbed();
  embed.setColor(0x63ff0f);
  embed.setThumbnail(member.displayAvatarURL);
  embed.setAuthor("Member Joined!", member.user.displayAvatarURL);
  embed.setFooter(`ID: ${member.id}`);
  embed.setTimestamp();
  embed.setDescription(`Welcome **${member}** to **${member.guild.name}!** You are member **${member.guild.members.size}!**`);
  
  welcomeChannel.send(embed);
  wc2.send(embed);
  if (member.guild.id === "458561977212469268") {
      
      member.send("I hope you enjoy this server. Don't forget to read the rules!").catch(O_o=>{ console.log("This user does not have DMs enabled")});
  }
});
pliant sinew
#

jesus christ that's a mess

lusty dew
#

Does anyone know how i'd be able to use mongodb and moment for my cooldown?

fallen arch
#

Umm I Have A Question

#

How Do You Fix = ReferenceError: server is not defined

blazing star
#

you define server

keen drift
#

big brain

blazing star
#

yes

smoky mica
#

xD

fallen arch
#

why you

#

why you bully me

#

ok nvm

#

i thought i will get help

blazing star
#

but thats actually what you do

#

if something isn't defined then you need to define it

lusty dew
#

oof

#

So true

#

Does anyone know how i'd be able to use mongodb and moment for my cooldown?

blazing star
#

why mongo for cooldowns

fallen arch
#

umm thanks ? xD

blazing star
#

ok

bright spear
#

@fallen arch they did help you, the issue is pretty self explanatory if you know the language and you didn't just copy and paste random code

fallen arch
#

i never copy people

blazing star
#

can you send the code you were using?

fallen arch
#

ok

lusty dew
#

oof

#

hastebin would be nice

#

uwu

blazing star
#

yea

fallen arch
#

ok

blazing star
#

oh

#

using function is weird

lusty dew
#

Also @blazing star I am using mongo to store the message author id and moment is to store the time and also if they try and use the command again before their time is up I can use the moment format

blazing star
#

or just store a timestamp and compare it later

lusty dew
#

or i can use mongo

#

:>

blazing star
#

:<

lusty dew
#

I tried what you said

#

if the bot resets

#

the thing wipes

#

so I am using a DB now

fallen arch
#

There

lusty dew
#

to prevent that

fallen arch
#

Did I do it wrong

blazing star
#

I would use an arrow function

fallen arch
#

but why is this not working

lusty dew
#

Well

#

Any errors?

#

If you already showed them I missed em

fallen arch
blazing star
#

can you get the stack trace

lusty dew
#

Then server isn't defined

#

?

fallen arch
#

how do u umm

blazing star
#

check the console

#

I bet servers is defined globally mmLol

#

oh

#

I see the issue

lusty dew
fallen arch
#

please tell me

lusty dew
#

I don't see where servers is defined at all

blazing star
#

same

lusty dew
#

or does it not need to be

blazing star
#

inb4 globally

fallen arch
#

i gave the code can u fix it for me(its ok if you cant i am just asking)

lusty dew
#

No

keen drift
#

kek

lusty dew
#

We can't

fallen arch
#

Ok

lusty dew
#

we can only help

fallen arch
#

Its Fine

#

Thanks

blazing star
#

well, what you can do is defined servers

#

and debug from there

lusty dew
#

Yea

fallen arch
#

wait this is what it shows in the console -(node:14032) DeprecationWarning: Collection#filterArray: use Collection#filter instead

keen drift
#

just like what it says

#

deprecation

lusty dew
#

Yea xD

keen drift
#

amazing what the error can tell you

fallen arch
#

xD

lusty dew
#

Ikr

blazing star
#

yes

lusty dew
#

So my question was never answered how could I make a cmd cooldown using mongodb and moment?

blazing star
#

you could store the timestamp when the user executed the command

keen drift
#

do you really need mongo or moment

lusty dew
#

Yes I do

#

uwu

blazing star
#

neither is really needed

keen drift
#

an in memory map would work with simple timestamps

lusty dew
#

Grr

fallen arch
#

i am such a noob

blazing star
#

yes

lusty dew
#

Nvm

blazing star
#

ok

lusty dew
#

Ill ask elsewhere

fallen arch
#

i am soo noob and u guys pros

blazing star
#

ok

sick cloud
#

if (!server) return;

#

ok

#

i've said my piece

fallen arch
#

i even dont know how to define the server

sick cloud
#

unnecessary markdown 👏

keen drift
#

then why you using it

blazing star
#

inb4 code copied

lusty dew
#

rip

bright spear
#

How did you write the rest of the code???

sick cloud
#

@blazing star the error message is copy pasted

lusty dew
#

Probably from Plexidev or smth

sick cloud
#

its that or commando

#

probably commando

blazing star
#

oh no I see plexidev and commando

#

bye

bright spear
#

Probably commando yeah

lusty dew
#

lel

fallen arch
#

guys how do i define the server

#

ok i am noob

blazing star
#

you just define server like you did with the rest of the code

lusty dew
#

Hm

#

do you even need the

#

[]

#

or servers

#

can't you just do

blazing star
#

its probably an object of ids

#

with more objects

lusty dew
#

Ah tru tru

#

Yea

blazing star
#

maps are better imo

lusty dew
#

Hm

fallen arch
#

no solution ?

keen drift
#

Cannot read property 'roles' of null

blazing star
#

probably a dm

keen drift
#

ensure member exist Thonk

blazing star
#

and that is also not how you check if a user has a role, ill let u figure that one out (docs also help)

#

and your trying to compare a Collection to a possible string

bright spear
#

It's pretty obvious that you don't know js or logic

keen drift
#

sounds like 90% of the questions in here

fallen arch
keen drift
#

Didn't you code it? Why you asking us Thonk

lusty dew
#
let x = 1 > 5

Wouldn't this allow me to pick a number between 1-5 or

Math.floor(Math.random() * 6) + 1
blazing star
#

adding one Thonk

keen drift
#

I think you gotta do max - min inside

lusty dew
#

I may have done the last one wrong

keen drift
lusty dew
#

I can't remember how I would do it

blazing star
#

I think random * num works too

keen drift
#

Math.floor(Math.Random() * (max - min + 1)) + min;

blazing star
#

¯_(ツ)_/¯

keen drift
#

no

lusty dew
#

yeet

blazing star
#

If im trying to kill a running child process would I send SIGINT or SIGTERM?

keen drift
#

@uneven laurel single role, has, compare by id

lusty dew
#

if(!message.member.roles.some(r=> r.name == "rolename") ) {
return
}

keen drift
#

then has, name

coral trellis
#
            const role = guild.roles.find(r => r.name === "roleName");
lusty dew
#
Math.floor(Math.Random() * (5 - 1 + 1)) + 1
#

So is this what you mean @keen drift

keen drift
#

yeah

lusty dew
#

Ok thanks

#

Now I have to make it detect if the person says a number between 1 - 5

fallen arch
#

You guys Fixed Your Problems?

lusty dew
livid swallow
#

Hi people 👋 Are there any devs here who could help me with my bot?

split hazel
#

@livid swallow sure what library you're using?

livid swallow
#

This is my first ‘production code’ type of bot and I need dome feedback.

#

I’m new - so feedback helps me improve my coding skills

lusty dew
#

yeet

#
                client.loadUserData = (message.author.id, data => {
                    if(data.rep_cooldown < 0){
                        var twentyfourh = new Discord.RichEmbed()
                        .setTitle(`Wait!`)
                        .setDescription(`You have to wait ${moment(data.rep_cooldown).format('MMMM Do YYYY h:mm:ss a')}`)
                        message.channel.send(twentyfourh)
                    }

                })
            })

is this how I would check if data.rep_cooldown is greater then 0?

split hazel
#

data.rep_cooldown === 0 would work as well but yes

spare glen
#

why don't you guys make it so @gilded plank send embeds instead of plane messages

knotty steeple
#

wrong channel

#

and it does send embeds think

fallen arch
#

oooooooh

livid swallow
#

Hi people 👋 Are there any devs here who could help me with my bot?

quartz kindle
#

just post your code and questions

earnest phoenix
#

Help me please, 403

mental solstice
#

what library

last ferry
#

What language are you using

mental solstice
#

javascript?

last ferry
#

Presumably js

mental solstice
#

unfamiliar.. but you may be able to do
let msg = message.channel.send('The response');

#

then msg.delete()

earnest phoenix
#

Please help me

#

Library : discord.js

sick cloud
#

@earnest phoenix send your code and error

earnest phoenix
#

Okay

#

@sick cloud check dm

wicked summit
#

Btw it'a an looping

#
for(let x of channels){
<option id="<%=x.id%>#<%x.name%></option>
}```
Using ejs
#

I tried to get the selected channel

earnest phoenix
#

any one know here

#

how can i do

#

days ago

#

in discord.js

#

with timestamp

amber fractal
#

new Date()?

lofty hamlet
#

Hello I have a question with an indexOf I can replace a choice in a array but it is possible to replace all these things ex:

Index of

To replace any indexsof

How should I do it?

fallen arch
#

what do i have to do to get bot dev role

#

?

lofty hamlet
#

@quartz kindle you can help me because yesterday you has help me ^^

#

Fo indexOf

earnest phoenix
#

that's it

fallen arch
#

Thats What I thought. thanks

earnest phoenix
#

Welcome

fallen arch
#

oh wait

#

i have a noobish question

earnest phoenix
#

yes

fallen arch
earnest phoenix
#

show code

fallen arch
#

ok

#

hastebin ?

earnest phoenix
#

ok

fallen arch
#

any problem ??

earnest phoenix
#

wait

fallen arch
#

Ok

#

wait if i upload the bot does that mean it will be hosted too

#

@R4A 乄 Hydrox#8573 Umm Hello

#

?

#

you didn't check it?

earnest phoenix
#

wait

fallen arch
#

umm ok

earnest phoenix
#

What is servers you haven't defined it I think

fallen arch
#

Another Noobish Question

#

How Do I Define The Server

earnest phoenix
#

xD

#

Construct a queue first

fallen arch
#

who me?

#

construct a queue me?

earnest phoenix
#

wait

#

see this

wicked summit
#

Lmao

#

Their code is commando

earnest phoenix
#

But he

#

server's isn't defined and he even don't know how to do

lofty hamlet
#

Hello I have a question with an indexOf I can replace a choice in a array but it is possible to replace all these things ex:

Index of

To replace any indexsof

How should I do it?

fallen arch
#

why you bully me

spring ember
#

@lofty hamlet can you give an example?

lofty hamlet
#

Hum

#
            fonction.channellogs(message)
            array = message.content.split(" ").slice(1);
            let xoargs = array[0]
            let xoargs1 = array[1]
            if (!xoargs) return message.reply("Erreur :Croix: : `Entrez le nom du pokémon à remplacé`")
            if (!xoargs1) return message.reply("Erreur :Croix: : `Par quel pokémon voulez-vous le remplacer ?`")
            //console.log(Dresseur.Sac.includes(xo03))
            if (Dresseur.Sac.includes(xoargs) || (Dresseur.LSSac.includes(xoargs) || (Dresseur.SSac.includes(xoargs)))) {
                Replacing = Dresseur.Sac.indexOf(xoargs)
                Dresseur.Sac[Replacing] = xoargs1
                var embedGlobal = new Discord.RichEmbed()
                    .setColor(embedcolor)
                    .setTitle("Pokémon remplacé")
                    .setThumbnail(message.author.displayAvatarURL)
                    .addField("Remplacé : ", xoargs)
                    .addField("Par : ", xoargs1)
                    .setFooter(client.user.username + " - by Nebulus")
                    .setTimestamp()
                message.channel.send(embedGlobal)
            }
            else if (!Dresseur.Sac.includes(xoargs)) {
                message.channel.send("Erreur :Croix: : `Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)`")
            }
    }```
#

My command test for replace one pokemon of my array

#

But this commande replace just one pokemon but if i have two even pokemon this command replace juste the first in the list i want thans this command replace all of this pokemon write

#

You understand ? ^^' @spring ember

spring ember
#
for (let index = start; index<start+amount; index++){
   array[index] = something
}
lofty hamlet
#

🤔

#

@spring ember

#

for this :

#

IndexOf

#

You don't understand

earnest phoenix
#

@quartz kindle Very sorry for the ping, remember the API you helped me set up? How would I restrict it to a certain role on discord? Would I have to create an API key for those?
And how would that be implemented into the API?

spring ember
#

Just do multiple indexOf?

lofty hamlet
#

Yes

spring ember
#

I don't really understand what are you trying to do here @lofty hamlet

lofty hamlet
#

but indexsOf (Exemple) don"t work

#

How i do ?

#

dondishAujourd'hui à 17:50 Just do multiple indexOf?

#

yES @spring ember

spring ember
#

@lofty hamlet just do a for loop and do if (array[index] === something) {doSomething()}

lofty hamlet
#

Ok thanks good idea

#

Hum

#

How i do loop @spring ember in discord.js 🤔

#

It's very possible ?

spring ember
#

Do you mean looping in JavaScript?

earnest phoenix
#

Anyone familiar with a Glitch API?

#

I need help with api keys

earnest phoenix
#

if(!message.guild.member(message.author).hasPermission("MANAGE_MESSAGES"))

split hazel
#

if(!message.member.hasPermission(['MANAGE_MESSAGES'])) return message.channel.send(` You are not permitted to use this command`); or something like that assuming you're using djs

#

@uneven laurel

spring ember
#

@split hazel message.member.hasPermission('MANAGE_MESSAGES') no need for an array

#

also no return

earnest phoenix
#

shh

#

😂

split hazel
#

why no return?

earnest phoenix
#

Okay so, I am trying to make an API Key System for my Glitch API. They have to specify their API Key in the URL /api/fact/{APIKEY}. All API Keys are stored in an apiKey.json file in the Glitch Project. I want my Patrons to only be able to get an API Key which I already know how to do. So the only thing left to do is find a way to add the API Key to the apiKeys.json file in the Glitch Project from my bot wich is not hosted on glitch, any idea how I could do that? PING ME WHEN YOU RESPOND PLEASE

quartz kindle
#

@earnest phoenix an API involves many different kinds of operations, its not limited to just requesting data. you can easily send data to an API using a POST request for example

#

you just need to create another endpoint, for example /api/create and have it create an api key and store it in the json file when you access the url

#

you can have your server create the key itself and send it back to you as a response, so you know the key you just created

#

to avoid anyone being able to create api keys, secure that endpoint with a special api key that only you know for example, which can even be hardcoded

earnest phoenix
#

Was thinking of that however, how would they send the api key back to that user?

#

Webhook or something? Idfk 😂

quartz kindle
#

you want the user to be able to create a key themselves?

#

or you want to create one for them?

#

if you want them to be able to create it, should they be able to create as many as they want? or limit to 1 per user for example?

vernal rivet
#

how do i grab data if the json data is in [{}], or will it be the same thing as doing it if its in {}?

quartz kindle
#

[] means its an array

#

so first you need to get the object from the array

marble elm
#

You can use dot notation for an object

quartz kindle
#

the same way you would get an item from an array

vernal rivet
#

ok, thanks

lusty dew
#
                client.loadUserData = (message.author.id, data => {
                    if(data.rep_cooldown < 0){
                        var twentyfourh = new Discord.RichEmbed()
                        .setTitle(`Wait!`)
                        .setDescription(`You have to wait ${moment(data.rep_cooldown).format('MMMM Do YYYY h:mm:ss a')}`)
                        message.channel.send(twentyfourh)
                    }

                })
            })

Is this how I would check if whatever is in data.rep_cooldown is greater then 0?

amber fractal
#

🤔

quartz kindle
#

you're checking if its smaller than 0

#

not bigger

amber fractal
#

Greater than (>) 0

lusty dew
#

tthanks

#

Also will the cooldown remove it's self from the db after the time is up or will I have to remove it myself?

amber fractal
#

1 > 0 true, 1 < 0 false, 1 > 1 false

#

Would it matter?

#

My cds arent deleted

#

Because if the time is > whatever the cooldown time was it would run anyways and auto create a new cd in its place

lusty dew
#

Ok so after it reaches 0 the person can use the cmd again

quartz kindle
#

that depends on how your database is structured

amber fractal
#

Well mine is different

lusty dew
#

I will show

amber fractal
#

Mine is an object that stores time and a spam counter

#

Not to mention the way i handle it is way different lmao

lusty dew
#

the DB_functions.js

#

is the file that has the data and such

#

the DB.js is how the Database is setup with the loadUserData and writeUserData

quartz kindle
#

are using any timer function or data type?

#

from what i can see, you're just using static values, and only increasing the cooldown, and never reducing it

lusty dew
#

Yea

#

That is all I have

#

I haven't figured out how to reduce it

quartz kindle
#

the database wont countdown for you

lusty dew
#

I kno

#

know*

quartz kindle
#

unless it has a specific timer data type or something

lusty dew
#

Ye

#

I can't figure out how o reduce it

quartz kindle
#

you cant

#

not that way

lusty dew
#

Oh

#

Ok

quartz kindle
#

if your database doesnt have timer functions, you cant use countdowns

#

you have to use another method, like comparing timestamps

lusty dew
#

How can I make a timer function?

#

I prefer to usse the DB way instead of comparinng timestamps

quartz kindle
#

check if your database supports some kind of timers of expiry dates

lusty dew
#

I think MongoDB does

#

My friend did it before

#

I just never asked how how

#

him*

quartz kindle
#

mongo has TTL

#

so you can try using that

lusty dew
#

yea I was about to say

#

So like

#

I would have to use the createIndex?

barren brook
#

Hello I’m a noob at coding and I need help,I don’t know how to work with ms npm

quartz kindle
#

i've never used mongo, but im assuming yes, it appears to be an index

lusty dew
#

Ok

quartz kindle
#

@barren brook what do you mean how to work with ms npm?

barren brook
#

Th ms npm for js

quartz kindle
#

well, what have you tried?

barren brook
#

Wdym?

lusty dew
#

He wants to know how have you tried using ms I think

quartz kindle
#

^

lusty dew
#

Also

#

is the createdAt thing necessary for the function?

#

Oh wait

#

Yea it is ok

#

doesn't

#

new Date()

#

give you the current date?

quartz kindle
#

yeah

lusty dew
#

Ok

#
    client.loadTimerData = (discordID, callback) => {
        db.users.createIndex( {id: discordID }, { "createdAt": new Date() }, { "expireAfterSeconds": 86400 } )
        callback()
    }
#

So I could do something like that?

quartz kindle
#

something like that yeah, then check if the index still exists before running the command

#

it should automatically delete itself after it expires

lusty dew
#
    client.loadTimerData = (discordID, callback) => {
        db.users.createIndex( {id: discordID }, { "createdAt": new Date() }, { "expireAfterSeconds": 86400 }, (err, res) => {
            if(err) client.log(err);
            callback(res);
        })
    }
#

I updated it

#

to add an err check

#

Also ok

#

I will have to find out how to see if the index still exists

#

I think I can use getIndexs()

#

Not much description on how to use it though

quartz kindle
#

i havent used mongodb before, so i cant say much about your code, but it looks alright, try it out and debug it if needed

lusty dew
#

ok

keen drift
#

In my js project, I used mongodb with the mongoose driver

#

with schema

viral spade
#

hi,
i am trying to send my server count to discordbots.org. i understand how to send a post request with certain parameters and headers and i know the post request i have to send to /bots/{bot.id?}/stats. i also have my API Key for those calls. but i don't understand where does this key token go. into the headers of the post call?

mossy vine
#

yes

keen drift
#

headers

#

Authorization header

viral spade
#
      'Authorization': 'Basic ' + new Buffer(username + ':' + passw).toString('base64')
   }   
#

this?

keen drift
#

do not prepend basic

#

just the token

viral spade
#

and no username?

keen drift
#

what username

#

There's no username nor paswd

viral spade
#
headers: {
      'Authorization': '83498testkey9784389'
 }
```
#

?

keen drift
#

yes

viral spade
#

thanks! this confused me

lusty dew
#

But I think the problem is the commands are not loading

#

But I don't know why they aren't

quartz kindle
#

loadCommands.js:29:27

lusty dew
#

Yea

quartz kindle
#

whats line 29 in that file?

lusty dew
#

I don't see anything wrong in that file

#

It is how it should be

#
if(client.commands[message.content.split(' ')[0].replace(client_settings.prefix, '')]) return true
earnest phoenix
#

how would I get it to show how many servers my bot is in on my dbl page?

slim heart
quartz kindle
#

what about anderson.js:15?

earnest phoenix
#

@slim heart I tried I don't understand it

slim heart
#

dont understand an api, read the docs of said api triggered

earnest phoenix
#

im using js do I go to javascript

slim heart
#

well, what do you think what

lusty dew
#
    if(client.commandExist(message) == false) return
#

@quartz kindle

#

that is in my anderson file line 15

slim heart
#

you can just do !

lusty dew
#

I know

slim heart
#

if(!client.commandExist(message)) return

lusty dew
#

Yea

#

ik

earnest phoenix
#
dbl.webhook.on('posted', () => {
  console.log('Server count posted!');
});

if I add this will it show on my my dbl page?

slim heart
#

no what

earnest phoenix
#
dbl.on('posted', () => {
  console.log('Server count posted!');
})

what about this

lusty dew
#

if you are console logging

#

it will log in the console

slim heart
lusty dew
#

not the page

earnest phoenix
#

I want it to the dbl page

slim heart
#

yes

lusty dew
#

Then look at what JPBBerry just showed

slim heart
#

.postStats

#

means it will

#

post it ▶ to the dbl page

earnest phoenix
#

how do I get my bots dbl api key

#

how do I get my bots dbl token?

slim heart
#

edit the bot and scroll all the way down

earnest phoenix
#

ok

earnest phoenix
#

you tell me

#

what are you trying to do

#

Just after adding the music to the waiting list ">add link" I want to do ">play" but he makes this mistake to me

#

what

#

Music command...

#

Sorry i'm french

ruby dust
#

forbidden usually means not enough permissions

earnest phoenix
#

But I just created the API

#

...

#

what api

#

YouTube Data V3

#

I think

earnest phoenix
#

I solved my problem I missed "ffmpeg" and "ffmpeg-binaries"

rocky mesa
#

So im making a bot that you can upload images to, but im getting this error

#
 1: 00007FF627E5121A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810
 2: 00007FF627E2A5B6 node::MakeCallback+4518
 3: 00007FF627E2AFA0 node_module_register+2160
 4: 00007FF6280BE5F6 v8::V8::ToLocalEmpty+54
 5: 00007FFFDEFD1EB9
 6: 00007FFFDEFD33C0
 7: 00007FFFDEFD9B35
 8: 00007FF627E2AE77 node_module_register+1863
 9: 00007FF628655782 v8::internal::OptimizingCompileDispatcher::Unblock+60562
10: 00007FF628656C1D v8::internal::OptimizingCompileDispatcher::Unblock+65837
11: 00007FF628655C79 v8::internal::OptimizingCompileDispatcher::Unblock+61833
12: 00007FF628655B5B v8::internal::OptimizingCompileDispatcher::Unblock+61547
13: 0000010D5F25C5C1```
#

anyone know how I would fix this?

sick cloud
#

what language

inner jewel
#

js

#

what's your code?

rocky mesa
#

uhh I cant send it all but 1 sec

#
const Discord = require("discord.js");
const { promisify } = require("util");
const readdir = promisify(require("fs").readdir);

const tokens = require("./tokens.json");
const settings = require("./settings.json"); // eslint-disable-line no-unused-vars

const client = new Discord.Client();
client.commands = new Discord.Collection();

client.memes = [];

const commandFiles = fs.readdirSync("./commands").filter(file => file.endsWith(".js"));

const log = async (message) => {
  console.log(`[${new Date().toLocaleString()}] - ${message}`);
};

const init = async () => {
  for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
  }
  console.log(`Loaded a total of ${commandFiles.length} commands.`);
        
  const evtFiles = await readdir("./events/");
  evtFiles.forEach(file => {
    const eventName = file.split(".")[0];
    //log(`Loading Event: ${eventName}`);
    const event = new (require(`./events/${file}`))(client);

    client.on(eventName, (...args) => event.run(...args));
    delete require.cache[require.resolve(`./events/${file}`)];
  });
  console.log(`Loaded a total of ${evtFiles.length} events.`);
};
init();

client.on("disconnect", () => log("Disconnecting..."));
client.on("reconnecting", () => log("Reconnecting..."));
client.on("error", e => log(e));
client.on("warn", w => log(w));

client.login(tokens.token);```
#

is my main file

inner jewel
#

huh

#

can you console.log before all your requires?

#

eg console.log("requiring A"); const a = require("A")

#

also try updating node

rocky mesa
#

Already did

#

Pretty sure v8 is a node error

inner jewel
#

anything else printed before that error?

rocky mesa
#

nope

inner jewel
#

what packages are you using?

rocky mesa
#

ill get my package.json

#
  "name": "wii-master",
  "version": "1.0.0",
  "description": "bot",
  "main": "wii.js",
  "dependencies": {
    "better-sqlite3": "^5.3.0",
    "discord.js": "^11.4.2",
    "fs": "0.0.1-security",
    "klaw": "^3.0.0",
    "moment": "^2.23.0",
    "mongoose": "^5.4.5",
    "parse-ms": "^2.0.0",
    "quick.db": "^7.0.0-b21",
    "string-similarity": "^3.0.0",
    "valid-url": "^1.0.9"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
inner jewel
#

can you try debugging what causes that error?

rocky mesa
#

wdym

inner jewel
#

with breakpoints/logging

rocky mesa
#

ill try

viral spade
#

hi,
"bot.guilds.size" thats the value i may send over post request to discordbot.org as server count, correct?

amber fractal
#

Should be

pale marsh
#

So I'm a beginner at python but I have this weird issue

#
async with aiohttp.ClientSession() as session:

I'm getting an invalid syntax error at with for some reason

#

Oh never mind. I got it

#

The function had to be async

#

Okay async is confusing me in python

#

How does one await an async function in the global scope?

ruby dust
#

Depending on your code, you sometimes don't need async there

pale marsh
#

I was writing a short snippet that would send a GET http request to an API and return the result

#

I made an async function that accepts data, makes the requests and returns the data. My problem is calling that function itself

#

I don't know why I don't grasp the concept of async in python smh

ruby dust
#

iirc, await should only be used inside async, and async should only be used in async functions

pale marsh
#

So await cannot be used in a global scope. Alright

#

Now what?

ruby dust
#

Just don't await

#

Nor async

pale marsh
#

What then? xD

#

I mean, aiohttp is async

ruby dust
#

Yes, which is why I think you don't need to async it again unless it's inside async function

#

I'm not 100% on this myself, I'm only saying what I've heard from others

pale marsh
#

The problem is that the return type is coroutine

#

Welp. From my understanding coroutine is like a Task object in C#

#

And google is of no help since I have no idea what I'm looking for

ruby dust
#

python coroutines without asyncio seems to be a popular search

pale marsh
#

Will look more into it

#

I appreciate your help Deivedux

#

Found a way to do it I think

#
loop = asyncio.get_event_loop()
loop.run_until_complete(awaitable_function())
loop.close()
#

No idea if that's how it should be done or not but it works

wicked summit
#

Someone know how to make custom commands?

earnest phoenix
#

-botinfo @gilded plank

gilded plankBOT
#
Bot info
ID

264811613708746752

Username

Luca

Discriminator

0393

Short Description

Luca is a bot for managing and informing members of the server

Library

discord.js

Prefix
  • or @Luca#0393
Total Upvotes

158

Monthly Upvotes

1

Server Count

96 Servers

Owner(s)

@fossil oxide dblAdmin dblMod
@languid dragon dblAdmin
@bitter sundial dblAdmin

earnest phoenix
#

Hey @languid dragon , how do you do the links

#

With text instead of urls

languid dragon
#

What

earnest phoenix
#

The footer

#

how u do that?

languid dragon
#

Google it

earnest phoenix
#

what the hell do I Google tho

languid dragon
#

It's not a footer

#

It's a field

earnest phoenix
#

I'm just noticed

#

Still

#

how?

languid dragon
#

Oh. My gosh

earnest phoenix
#

markdown

languid dragon
#

Look at the documentation of your library

#

And use markdown

earnest phoenix
#

okay..

#

you can do that?

languid dragon
earnest phoenix
#

you

#

yeah

languid dragon
#

Only in embeds

#

Via bots

earnest phoenix
#

ohhh

#

okay

#

you can do it in the desciption

#

I'll try it, tysm!

#

only

#

@burnt holly

glass linden
#

Anyone know why my music bot keeps skipping randomly during a song? I've asked quite a few people but they couldn't figure it out.

earnest phoenix
#

Library?

#

And Device

glass linden
#

Discord.js and wdym device?

earnest phoenix
#

the device your running it on

#

Stuff like

#

Ram, CPU, that stuff

#

Os too

glass linden
#

OS I'm not sure of

amber fractal
#

Like skipping the song completely?

#

Or like a buffer

glass linden
#

Skipping the song completely, but its random

#

I checked with my host etc

#

Its not them

#

This started happening recently

#

Like 3 days ago

amber fractal
#

Does the next song start?

glass linden
#

Yes.

amber fractal
#

Could be deleting it from however you setup the queue.

glass linden
#

Hmm really?

amber fractal
#

Ytdl right?

glass linden
#

Yes

#

ytdl-core package

#

I have latest version too

earnest phoenix
#

we can't help with ytdl

glass linden
#

And i get no console errors.

earnest phoenix
#

against yt tos

amber fractal
#

?

#

What

glass linden
#

It's a package....

amber fractal
#

How is it against their tos

glass linden
#

Sure you can help lol

earnest phoenix
#

lemme get ot

#

It

glass linden
#

Okay.....

#

I don't understand lmfao...

earnest phoenix
#

that's from python server

#

does it apply hetr

#

hetr

#

Here

#

Idk

glass linden
#

That's a different server though....

#

So i don't get how it applies here lol

earnest phoenix
#

lol yeah I'm stupid, I'm going to go now

amber fractal
#

Yt wouldnt have an api if we couldnt use it

earnest phoenix
#

💯

amber fractal
#

Theres a reason we need an api key tho

glass linden
#

Idk Python is rood too

#

So lol

amber fractal
#

Anyways

glass linden
#

Yea... my issue is strange

#

But i know someone with the issue as well

amber fractal
#

Looking this up on their github, i see people had ECONNRESET and their stream crashes

glass linden
#

Hmm interesting 🤔

amber fractal
#

Take a look there see if anything helps you?

#

Thats quite old tho

glass linden
#

Yea ;/

#

Mine doesn't even show an error

amber fractal
#

These are always the hardest to test/debug because you said its seemingly random right?

glass linden
#

Yes

#

But mostly at the end

amber fractal
#

You have an api key, yes?

glass linden
#

Yes

#

I changed it today

#

Cause i thought that was the case

#

But i guess it wasnt

inner jewel
#

ECONNRESET is a network error

amber fractal
#

I was thinking it was a network thing

glass linden
#

Ah

amber fractal
#

But if it plays the next vid

#

Idk if it would be

glass linden
#

Yes it skips then goes to next song

#

Then skips next song

#

It repeats the cycle lol

inner jewel
#

network errors can happen randomly

amber fractal
#

Can you see what the bandwidth limitations of your host are?

#

Or if they changed recently

glass linden
#

Okay ill ask them

amber fractal
#

What provider do you use?

glass linden
#

I can say the name correct?

#

SyroNodes

#

Its a friends host

#

But i think they may be sleeping

amber fractal
#

You on the small bot plan then?

glass linden
#

Yea, it was working last month without any problems

#

and last week actually

amber fractal
#

Its weird they dont give a lot of data about their network

glass linden
#

They're new so they may not have a lot of info

#

I think Idk lol

amber fractal
#

They may be new to hosting for bots

#

Idk why thats its own category

glass linden
#

xD

amber fractal
#

They are also a game host so it makes sense

#

not really but

glass linden
#

Ok im getting the bandwidth limitations from them

amber fractal
#

I mean i still dont know if thats even the error

glass linden
#

They said i have unlimited

amber fractal
#

Do you have root access?

visual zenith
#
        let com = [];
        com = [];
        const commandList = client.comman.get('command')
        const commands = client.comman.map(c => {
          for (i = 0; i < commandList.length; i++) {
        com.push(`${c[i].name} :: ${c[i].description}`)
          }
        });
        console.log(JSON.stringify(com));
``` code ☝ 
error: https://pastebin.com/LLkFeDJD ;/
glass linden
#

@amber fractal Wdym by "root"

amber fractal
#

If it is a linux OS

#

BUt generally speaking,

#

admin rights

glass linden
#

Ah

#

No i dont

amber fractal
#

How do you get packages?

#

is it a list

glass linden
#

Yea

amber fractal
#

@visual zenith can you log it before you stringify it? see if its the same

#

Do you have a console to run commands atleast?

glass linden
#

Yes ofc

amber fractal
#

Im gonna assume its linux

glass linden
#

Well idk tbh

#

It runs Pterodactyl Software

amber fractal
#

Im not glod with any terminal tbh, im just trying to get commands for bandwidth usage mmLol

#

Thats a game server management panel

glass linden
#

Oh lol

#

I see

#

But there using it for a bot hosting

amber fractal
#

Yeah

#

Can you send a picture of what the console looks like, may help identify it lmao

#

Blur any sensitive info

#

Or dont send it mmLol thats an option

glass linden
#

It doesnt really show too much info

amber fractal
#

try just running 'help' in the console

glass linden
#

didnt do anything lol

amber fractal
glass linden
amber fractal
#

How about uname -r (it should give you a version if it is linux according to this video)

glass linden
#

nope

earnest phoenix
#

UGH

#

This sucks

#

I cant

amber fractal
#

It may be because no perms

earnest phoenix
#

wait a second

#

Wrong chat sorry

glass linden
#

But the thing is this is weird how u need to execute commands

amber fractal
#

Hym?

glass linden
#

U need to stop the bot

#

go into this other panel

#

right the command

#

save it

#

and start the bot

amber fractal
#

🤔

#

You should just be able to type it in tbe console

#

And hit enter

glass linden
#

Idk doesnt work

amber fractal
#

This host seems weird lmao

glass linden
#

xd

amber fractal
#

Let me just make one thing clear. You're sure no skip/stop command is being used

glass linden
#

Nope

#

Nothing like that is happening

amber fractal
#

You got something like const dispatcher = serverQueue.connection.playStream(ytdl... in that code then?

#

or similiar

glass linden
#

Yes

amber fractal
#

Then you have an error event for it, correct?

#

.on('error', error => console.error(error));

glass linden
#

Yes

amber fractal
#

Try logging the time of the video, it should be possible, I havent worked with ytdl in forever

#

Theres probably an actual reason

#

Im just not the guy to debug it mmLol

glass linden
#

Like when you mean the time of the video like how long it is?

amber fractal
#

Yes

#

I mean it probably doesnt make a difference

#

But whenever i encounter an error i just log everything

#

It has seemed to work atleast lol

glass linden
#

I log everything too

#

But for some reason its not logging anything

amber fractal
#

But it plays still

glass linden
#

Yea

amber fractal
#

Were the changes applied then

glass linden
#

Wdym?

amber fractal
#

I swear were gonna do all this then someone that is more experienced than both of us will know the reason exactly

visual zenith
#

@amber fractal its still the same since its an array that has too much items

amber fractal
#

So it logs a bunch of undefined then?

earnest phoenix
#
            color: 2003199,
            description: "**:CrossMark: | You must be in the same voice channel to skip the song.**",
        }});  ```
#

anything wrong in this

glass linden
#

@amber fractal But yea Idk anymore, It could be something hard to figure out lol

amber fractal
#

@earnest phoenix not syntax wise

earnest phoenix
#

means

amber fractal
#

Syntax is valid?

#

I mean

earnest phoenix
#

yep

amber fractal
#

Idm how else to explain it

earnest phoenix
amber fractal
#

You asked if anything was wrong with it, i told you that nothing is wrong syntax wise

earnest phoenix
#

How I fix it it

glass linden
#

@amber fractal Thanks for the help I'll see if anyone else tags be tomorrow to see if they can help me figure it out

earnest phoenix
#

it's not working

#

let me try once more

#

Now working

amber fractal
#

If thats tge same video i watched a while ago, it was just voiceChannel: voiceChannel

earnest phoenix
#

hmm

#

I'm trying to move my whole bot from d.js to eris

amber fractal
#

Oh

#

Well I use d.js so not entirely sure

earnest phoenix
#

@tired rose

#

bye

earnest phoenix
#

So you can't redirect using bot @prime cliff

prime cliff
#

Oh wait heck it diddnt redirect wait what

#

Idk its weird

lusty dew
#

Does anyone know how to make a VPS using google cloud?

earnest phoenix
#

rip

lusty dew
#

Do I create a VM instance?

earnest phoenix
#

idk

lusty dew
#

Then don't answer

earnest phoenix
#

@prime cliff doesn't work

lusty dew
#

What are you even trying to do? @earnest phoenix

earnest phoenix
#

redirect a bot invite link to the support server

lusty dew
#

Erm

#

then try putting the support server url at the end?

#

I think that is how you do it

earnest phoenix
#

doesn't work

lusty dew
#

or just google how to do it

#

Google is your best friend

earnest phoenix
#

google wouldn't know

lusty dew
#

...

earnest phoenix
#

if discord doesn't know

#

might need to join discord support

lusty dew
#

That is literally the most stupidest shit I have ever heard

earnest phoenix
#

Kawaii

#

Listen buddy...

#

This doesn't even work.

#

It doesn't redirect.

#

and It's straight from discord.

#

That's how it supposed to work

lusty dew
#

...

#

You aren't doing it right maybe?

earnest phoenix
#

OK, you try.

#

Bot's ID:

#

522771517365420032

lusty dew
#

LLol

#

You were doing it wrong @earnest phoenix

#

I got it to work

#

you have to select guilds.join as well along with bot

#

then have the redirect url

#

after the bot is invited to the server

#

the inviter is redirected to the link you put

#

That should make it work

earnest phoenix
#

How would I do it to redirect to my website

lusty dew
#

Put your websites url in the Reddirect spot

#

you should be able to add urls

#

it will have a spot for it

#

close to the top

#

then you can use them

#

but

#

instead of guilds.join

#

I think you need to check webhook.incomoing

earnest phoenix
#

Okay

lusty dew
#

I haven't done it with website urls

#

only Discord inv

inner jewel
#

that's doing oauth wrong

#

redirect_uri is for the oauth2 flow

#

not for "redirect user there after bot is added"

lusty dew
#

🤷 I was just telling him what worked

inner jewel
#

also you should use identify instead of guilds.join

#

will achieve the same effect

lusty dew
#

for me

#

Yea

#

Ig

inner jewel
#

but doesn't grant an abusable scope

lusty dew
#

Never used Identify

inner jewel
#

any scope besides bot works

lusty dew
#

didn't know it did the same thing

inner jewel
#

because those trigger the oauth flow

lusty dew
#

Ah ok

#

Also Natan while you are here. Do you know how to setup a VPS using Google cloud?

#

DO I need to create a VM instance

#

Do*

inner jewel
#

/shrug

lusty dew
#

Ah ok

earnest phoenix
#

Identify works yas

lusty dew
#

Does anyone know how much Memory 2 discord bots and a few website would need to Host?

keen drift
#

depends how big

sick cloud
#

also depends on the uses of those thing(s)

#

and how actively used they are at x time

lusty dew
#

I just don't want to spend a ton of money

keen drift
#

if it's at state zero, 10mb max

sick cloud
#

i can't be one to say, i host like 24 bots, 14 websites, 2 bot lists and a couple mc servers on one dedi and its barely using 10% of resources bloblul

lusty dew
#

What VPS do you use Tony

sick cloud
#

i use a dedicated server from OVH

earnest phoenix
#

I'm using a raspberry pi for a small bot and it's good

sick cloud
#

@earnest phoenix if you have good internet they're ok

earnest phoenix
#

Yes

lusty dew
#

You spend a good amount of money?

sick cloud
#

i couldn't ever use my PI since my internet is 1mbps at good times, and it gets sweltering here so cooling is horrid

#

yeah its $99 a month :L

lusty dew
#

Wow

#

How do you afford that?

sick cloud
#

i don't

lusty dew
#

oh...?

keen drift
#

http server 0.8mb usage

lusty dew
#

I am using google cloud VPS

earnest phoenix
#

can I have reaction role invite fishy

lusty dew
#

It gave me 300$ credit

keen drift
#

kek

#

those credits will fly

lusty dew
#

Yea, I know xD

keen drift
#

especially the most minimal vm is like $20

lusty dew
#

You can get one for 4$

#

but it has 0.6gb

keen drift
#

yeah that should be enough

earnest phoenix
#

I want to get some Google cloud stuff

keen drift
#

if you optimize your code

earnest phoenix
#

Just API stuff tho

#

The translate api

lusty dew
#

Optimize it how?

keen drift
#

Correct memory recycling

lusty dew
#

Hm

#

I don't know how to do that

#

lol

keen drift
#

only available with some low level lang

lusty dew
#

Js?

keen drift
#

my authorize http server is built on rust

#

no gc

lusty dew
#

I wonder how much 1 discord bot would take up

#

if it was rather small

#

with only like 10-20 cmds

earnest phoenix
#

my bot has

#

Wait lemme count

lusty dew
#

Just go to the folder with the cmd files in it

earnest phoenix
#

10 cmds

sick cloud
#

commands don't matter

lusty dew
#

yea

#

lol

sick cloud
#

i have 14 commands and use up to 1.5gb

lusty dew
#

wow

sick cloud
#

but my bots always being used

#

7.2k servers

lusty dew
#

uwu

sick cloud
#

other things come into count

lusty dew
#

I wish I could get a good vps

#

xD

#

Google Cloud is the only thing I can use

#

rn

#

Also my bot will only be in one server

#

it is a private bot

sick cloud
#

then like a 1gb vps would be fine at most

lusty dew
#

Ok

inner jewel
#

command count usually doesn't affect memory usage

#

bot size affects way more

#

if you cache stuff, that is

sick cloud
#

unless your like me and put all your cmds in memory

#

collections and stuff are probably bad for it i bet

inner jewel
#

unless you fill them with garbage

#

they're not

sick cloud
#

oh ok

lusty dew
#

The VPS I am gonna use would last me 13 months

#

in total

#

if I kept paying

#

Now I need to figure out how to use itt uwu

dusk skiff
#

i access my VPS via a website

#

remotely controll windows server 2016 data center all from a chrome book

#

because i can 😂

#

i paid like 70 a year for 4gig ram few cores

#

was a heck of a deal 😂

sturdy delta
#

args.join(' ').slice(22); what is a newer version of dat

keen drift
#

@lusty dew honestly aws free tier is prob better

sick cloud
#

@sturdy delta there's no newer version of args lmao

sturdy delta
#

lol

#

nvm

#

i meant like non-error causing

sick cloud
#

if it causes errors

#

its your code

earnest phoenix
#

what does this mean

languid dragon
#

you're trying to send a string that isn't declared as a string

#

you can't send ``` on it's own

#

you must send it like: "```"

dark yacht
#

i use `${""}Some text here${""}|

earnest phoenix
#

id use string concetation

earnest phoenix
#

dang that keyboard looks like apple

dark yacht
#

xd

sick cloud
#
\`\`\` stuff \`\`\`
#

use \ to escape

inner yoke
#

``` testings stuff ```

#

😂

sick cloud
#

exactly

#

so you can use \ to do ie *this* and _this_

junior nacelle
#

Hey what service are people hosting their bots on? I assumed Heroku but figured I'd ask

sick cloud
#

lol yes everyone hosts their bots on heroku

#

most of us sensible devs use a VPS or dedicated server

junior nacelle
#

@sick cloud you mean a dedicated server of your own or you purchase resource allotment; sorry I am really new to this type of programming. I've only work with web programming.

#

I mean it kind of makes sense that Heroku is not ideal (when free) and it is fairly easy and cheap to throw together a Raspberry Pi (or superior alternative devices) - another thing I will look into

livid swallow
#

Hi, are there any devs around? My bot was rejected for not have any functionality- but it does. I’ve documented it in the help file and included a help message explaining everything

sick cloud
#

like rented

void mantle
#

@livid swallow this is not the appropriated channel for that question.

earnest phoenix