#development

1 messages ยท Page 1387 of 1

pale vessel
#
const connection = await mysql.createConnection({host:'localhost', user: 'root', database: 'test', Promise: bluebird});
 
// query database
const [rows, fields] = await connection.execute('SELECT * FROM `table` WHERE `name` = ? AND `age` > ?', ['Morty', 14]);```
#

like that

stable nimbus
#
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: botdb.query is not a function```
umbral zealot
#

ok we're getting somewhere now

#

that is a completely different fucking error

stable nimbus
#

Oh I forgot.

pale vessel
#

suuuure

stable nimbus
#

It did it on query.

umbral zealot
#

So the problem is probably that either you're not passing the same botdb to the run function, or the mysql library isn't happy with you adding random methods to it

stable nimbus
#
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: botdb.query is not a function
    at Inventory.run (C:\Users\dargc\Desktop\Coding\rpbot\commands\Civilian\inventory.js:22:21)
pale vessel
#

uh

#

use what i sent

#

don't complicate things

#

especially on your level

umbral zealot
#

yeah really you're reinventing the wheel and it's not turning right now ๐Ÿ˜‚

slender epoch
#

hello, when i do a command i want it to appear: check your messages md! I want him to send a message in the chat and another to me just with a command

rose warren
#

@slender epoch what library are you using?

slender epoch
#

Bot desinger for discord

umbral zealot
#

that's not a library that's an app, we can't help you with that

pale vessel
#

@stable nimbus
do a quick npm uninstall mysql npm i mysql2and try the example```js
const mysql = require('mysql2/promise');

const connection = await mysql.createConnection({host:'localhost', user: 'root', database: 'test'});

const [rows, fields] = await connection.execute('SELECT * FROM table WHERE name = ? AND age > ?', ['Morty', 14]);```

rose warren
#

That's not a library ๐Ÿ˜‚ learn to code javascript. Honestly it's more flexible.

slender epoch
#

that's not a library that's an app, we can't help you with that
@umbral zealot
BSscript

stable nimbus
#

All of my other functions where I use it work perfectly fine, but for some reason when I look for just one thing it just says "F U Buddy".

eternal solstice
#

any basics teaching site

umbral zealot
#

yeah that's a special snowflake language @slender epoch you should join their support server or look up tutorials. you're not doing "development" at this point.

rose warren
umbral zealot
#

no

stable nimbus
#
umbral zealot
#

don't point people to a bot guide when they need to learn JS, @rose warren

twilit rapids
#

Is there actually a way to debug where a UnhandledPromiseRejectionWarning is coming from if it provides no further content than just the warning itself, it's been annoying me for a while now

rose warren
#

Tbh using a bot to learn js is a good exercise imo ๐Ÿคทโ€โ™‚๏ธ

umbral zealot
#

No, it's not a good exercise, it's like learning to cook by making Beef Wellington. It requires advanced skills that beginners don't have.

rose warren
pale vessel
#

i mean you can see details if you handle/catch all your promises @twilit rapids

twilit rapids
#

Well that's the thing, I have everything in try catches

pale vessel
#

do you await them?

umbral zealot
#

I just do this ```js
process.on("unhandledRejection", err => {
console.error(err);
});

so that it prints more of the stack ๐Ÿ™‚
rose warren
#

If he makes a bot on Heroku etc where you don't have any vps to set up then it's a good way to learn js

twilit rapids
#

do you await them?
@pale vessel yes but I also handle those

#

Hmm I'll try that

umbral zealot
#

@rose warren where it's hosted is irrelevant. You can code a bot locally without a VPS. Beginners don't even understand strings, functions and conditions, how are they supposed to make bots based on promises, callbacks and event handlers? People should have a good grasp of programming Before making bots.

#

And yes some people are self-taught. Those people don't come crying to development servers for simple errors because they're self-taught ๐Ÿ˜›

delicate shore
#

I'm in love with schemas already

rose warren
#

Yeah sure. I agree, but everyone has to start somewhere. I taught myself HTML, PHP and CSS way back in the day while making websites. You have to apply what you're learning. Having a project you can build on while you learn is very rewarding.

delicate shore
#

I love mongo dB

#

It's so much better than quick.db

umbral zealot
#

Everything is so much better than quick.db.

twilit rapids
#

That seems to be logging this

[Error] { name: undefined }
[Error] { name: undefined }
umbral zealot
#

sounds like you're going through a logger feature that's not printing out the entire thing ๐Ÿ˜‰

#

fuck it's 3 am why am I still helping people

twilit rapids
#

Haha, gn

rose warren
twilit rapids
#

sounds like you're going through a logger feature that's not printing out the entire thing ๐Ÿ˜‰
Nope, just console.errror() btw

vale garden
#

hi

low shard
#

hi

ionic shard
#

yo im tryna use oAuth but im confused kinda like, where do i get data when someone logs in

astral yoke
#

anyone know why setParent wont work in this

#
        let channel = message.guild.channels.create(`${message.author.username}s-ticket`, {
            type: 'text',
            permissionOverwrites: [
                {
                    allow: 'VIEW_CHANNEL',
                    id: message.author.id
                },
                {
                    deny: 'VIEW_CHANNEL',
                    id: message.guild.id
                },
                {
                    allow: 'VIEW_CHANNEL',
                    id: '710751019495194645'
                }
            ]
        })
        let category = bot.db.get(`ticketcategory_${message.guild.id}`)
        channel.setParent(category)
        channel.send(`<@${message.author.id}>`) 
        let embed = new MessageEmbed()
        .setDescription(`Opened.`)
        message.channel.send(embed)```
#
        if(!id) message.reply("Need the category id.");
        if(id) {
            bot.db.set(`ticketcategory_${message.guild.id}`, id)
        let embed = new MessageEmbed()
        .setDescription(`Set to ${id}`)
        message.channel.send(embed)```
lusty quest
#

is the category id the id of the category on the server?

astral yoke
#

yeah, i double checked htat

tired panther
#

Everyone has on top.gg a nice page, How can I built in html, with justhaving one main file?

lusty quest
#

did you pass it as a string? or as a number?

#

should not matter but discord is sometimes finicky

astral yoke
#

i evaled what it was and it was the category id

lusty quest
#

maybe pass it as a string

#
`${category}`
``` should not make a difference but its worth a try
astral yoke
#

it errors as TypeError: channel.setParent is not a function

pale vessel
#

await it

#

await channels.create()

lusty quest
#

you could also chain it with the channel creation (the .setparent)

astral yoke
#

It went through the code with no error but didnt put it in the category .

#

I can try that

lusty quest
#

like this server.channels.find("name","general").setParent(categoryID);

#

(its a almost 2 years old stackoverflow post so it uses V11)

pale vessel
#

you're not awaiting it so it won't return a channel but a promise and you can't setParent a promise

lusty quest
#

also this ^

#

stuff that creates stuff you want to use further should be awaited

astral yoke
#

not use to coding await

#

just a habit

pale vessel
#

use .then() then

astral yoke
#

I have

#

(node:17268) UnhandledPromiseRejectionWarning: ReferenceError: Cannot access 'channel' before initialization

#

let channel = await message.guild.channels.create(`${message.author.username}s-ticket`, { type: 'text', permissionOverwrites: [ { allow: 'VIEW_CHANNEL', id: message.author.id }, { deny: 'VIEW_CHANNEL', id: message.guild.id }, { allow: 'VIEW_CHANNEL', id: '710751019495194645' } ] }).then(channel.setParent("777062285793427457"))

pale vessel
lusty quest
#

run the set parent seperate and see it it works then

pale vessel
#

it's .then(channel => channel.setParent())

astral yoke
#

should I get rid of the let channel = then?

lusty quest
#

or this yea

pale vessel
#

nah don't

#

setParent() returns the channel back, where you can use send()

astral yoke
#

It worked

#

ty

#

thank you two

pale vessel
#

hol up

#

it returns the category

astral yoke
#

now time for a ticket close and message reaction for it

pale vessel
#

you need to use js const channel = await guild.channels.create(); await channel.setParent(id); channel.send();

#

otherwise right now it would try to send a message to the category

astral yoke
#

how would i filter out the channel and then delete it?

lusty quest
#

store the channel ID in a Database and then just fetch it and delete it

astral yoke
#

thats what i was thinking

#

or a map

#

like var ticket = new Map();

lusty quest
#

storing it in a database is persitent over restarts

eternal osprey
#

hey guyss

#

the distance from last raid returns undefined

lusty quest
#

define the coordinate

eternal osprey
#

is it because my lat1 lat2 lng1 and lng2 are defined outside the function?

astral yoke
#

whats lastcoordinated supposed to be defined as

lusty quest
#

yes they are outside the scope. if you need them in the function pass them into the function

eternal osprey
#

sory for the long text

#

let me bin it

lusty quest
#

use hastebin the next time

eternal osprey
#

i was a step-ahead ๐Ÿ™‚

lusty quest
#

pass the last coordinate to the function too

#

then it will work

eternal osprey
#

wdym?

lusty quest
#

function calcCrow(lat1, lng1, lat2, lng2, lastcoordinate) {

#

and in your function call pass it too

eternal osprey
#

still did not work

lusty quest
#

did you pass the coordinate also in your function call?

eternal osprey
#

in what function call?

#

i have multiple ones

lusty quest
#

where you call your function?

#

where you call the function that draws the embed?

eternal osprey
#
 let text = `**${name}**` + "\n"
                      + `**${raid.gym_name}**` + "\n"
                      + `*${lat1}, ${lng1}*` + "\n"
                      + `**Raid level: **${raid.level}  |  **Pokemon Cp: **${raid.cp}\n`
                      + `**Distance From Last Raid: **${lastcoordinate}` + "\n"
                      + `**Egg Spawn Time: ** ${getFormattedTime(raid.raid_spawn)}\n`
                      + `**Raid Start Time: **${getFormattedTime(raid.raid_start)} | **Raid End Time: **${getFormattedTime(raid.raid_end)}\n`
                      
          let msg = await message.channel.send(text);``` it isn't an embed
#

it is just text

lusty quest
#

yea but when you call this function you pass coordinates right?

eternal osprey
#

exactly

lusty quest
#

pass the last coordinates also to it

#

so you can use them inside the function

eternal osprey
#

ooowh you mean this:

#
 let lastcoordinate;
          function toRad(value) {
            return value * Math.PI / 180;
        
        }
        ```
lusty quest
#

no

eternal osprey
#

this is how i return the lastcoordinate

lusty quest
#

you call this function calcCrow somewhere right?

eternal osprey
#

yeah

lusty quest
#

ohh wait nvm the text is outside of the function

eternal osprey
#

yeah that is the problem why it returns undefined

lusty quest
#

yea last coordinate never gets any data

#

so its always empty

eternal osprey
#

i think because my lat1 lat2 etc are defined outside the function

#

how would i fix it

lusty quest
#

how did you get last coordinate?

#

with the function above right?

eternal osprey
#

the lastcoordinate is lat2-lat1

#

etc

#

so calcrow

#

and the lat2 and lat1 lng1 and lng2 are defined above the function:

lusty quest
#

yea

eternal osprey
#
const lat1 = raid.lat.substring(1);
          const lng1 = raid.lng.substring(1);
          fs.writeFileSync("./lastcoordinate.json", [lat1, lng1])
          console.log(name, + "\n" + raid.gym_name, + "\n" + raid.lat, + "\n" + raid.lng);
          
            
          const lat2 = fs.readFileSync("./lastcoordinate.json", [lat1])
          const lng2 = fs.readFileSync("./lastcoordinate.json", [lng1])
          


          let lastcoordinate;
          function toRad(value) {
            return value * Math.PI / 180;
        
        }
        
        function calcCrow(lat1, lng1, lat2, lng2, lastcoordinate) {
            var R = 6371;
            var dLat = toRad(lat2 - lat1);
            var dLon = toRad(lng2 - lng1);
            var lat1 = toRad(lat1);
            var lat2 = toRad(lat2);
        
            var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
                Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
            var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
            var d = R * c;
            return d;
        
        }````
lusty quest
#

but you never write anything into the lastcoordinate value

#

this is why its empty

eternal osprey
#

yeah as the lat2 and lat1 are never defined

#

as they are outside the function right

lusty quest
#

they are defined at the top atleast lat 2

#

and lat 1 too

eternal osprey
#

yeah but they are outside the function

lusty quest
#

to rad or calccrow?

eternal osprey
#

the values are both undefined at torad and calcCrow

lusty quest
#

you need to pass them into the function

eternal osprey
#

yeah i am trying to figure out how to

#

any examples that i may use?

lusty quest
#
let lastcoordinate = calcCrow(lat1, lng1, lat2, lng2)
console.log(lastcoordinate)
#

this will call your function and set it as lastcoordinate

#

the log is just for checking the output

eternal osprey
#

where should i define that? above torad or right above the function calcCrow

lusty quest
#

would do it beneath the function but it should not matter iirc

eternal osprey
#

or right above let text?

#

ah okay

#

yeah i got it

lusty quest
#

above the text

eternal osprey
#

but haven't i already declared lastcoordinate?

#

it would declare it double which is not possible

lusty quest
#

you set it but never added any value to it

#

remove the other one

eternal osprey
#
let lastcoordinate;//so i should remove this?
          function toRad(value) {
            return value * Math.PI / 180;
        
        }
        
        function calcCrow(lat1, lng1, lat2, lng2, lastcoordinate) {
            var R = 6371;
            var dLat = toRad(lat2 - lat1);
            var dLon = toRad(lng2 - lng1);
            var lat1 = toRad(lat1);
            var lat2 = toRad(lat2);
        
            var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
                Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
            var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
            var d = R * c;
            return d;
            //and add the let lastcoordinate = ...... here?
        }```
#

or am i horribly wrong at the moment?

lusty quest
#
let lastcoordinate;//so i should remove this?
          function toRad(value) {
            return value * Math.PI / 180;
        
        }
        
        function calcCrow(lat1, lng1, lat2, lng2, lastcoordinate) {
            var R = 6371;
            var dLat = toRad(lat2 - lat1);
            var dLon = toRad(lng2 - lng1);
            var lat1 = toRad(lat1);
            var lat2 = toRad(lat2);
        
            var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
                Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
            var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
            var d = R * c;
            return d;
            //and add the let lastcoordinate = ...... here?
        }
//add it here
eternal osprey
#

aha okay

#

the rest what i said was right?

lusty quest
#

if you set it after a return it will be never be true

#

yes

eternal osprey
#

kay thans i will try!

#

hmm

lusty quest
#

did you check the output?

eternal osprey
#

Egg 0Bay Scallops In New York State 040.503634 0-74.218792
program.js:65
NaN

#

that is my conole.log

#

the NaN

lusty quest
#

looks like there is an error in your function

eternal osprey
#

should i bin my whole code?

#

might make it easier to identify the problem?

lusty quest
#
            var R = 6371;
            var dLat = toRad(lat2 - lat1);
            var dLon = toRad(lng2 - lng1);
            var lat1 = toRad(lat1);
            var lat2 = toRad(lat2);
        
            var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
                Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
            var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
            var d = R * c;
            return d;
       
        }```there is somewhere the error
eternal osprey
#

is it because i am returning d?

#

but not calling d in the text

#

but lastcoordinate

lusty quest
#

debug the function and check if every step is doing what is called

#

d = lastcoordinate

eternal osprey
#

no that wouldn't be it

quartz kindle
#

show your full code again

eternal osprey
#

okay

lusty quest
#

you still refer to outdated modules

eternal osprey
#

dw i should remove them

#

i am not using them right now. They were from an older project.

lusty quest
#

request is deprecated and no longer maintained

eternal osprey
#

i am not using promise anywhere

#

i just defined it as i started the project using different modules to see what would be the best approach

lusty quest
#

why did you refer it then? sure wont break anything but it looks messy

eternal osprey
#

i just defined it as i started the project using different modules to see what would be the best approach
@eternal osprey .

quartz kindle
#

@eternal osprey your lat and lng variables are all fucked up

lusty quest
#

also is this your entire bot?

#

bcs you call a new Discord.Client in there

quartz kindle
#

lat1 and lng1 are strings, not numbers, and lat2 and lng2 are reading directly from a file and not being parsed in any way whatsoever

eternal osprey
#

this is my entire bot

quartz kindle
#

console.log(lat1,lng1,lat2,lng2)

eternal osprey
#

okay on my way to log them

quartz kindle
#

also, the second parameter for readFileSync is an object of options

#

idk why you're giving it lat1 and lng1 in an array

eternal osprey
lusty quest
#

lol thats everything but what you want to use

eternal osprey
#

yeah i see now.

quartz kindle
#

you're reading the file as a buffer

earnest phoenix
#

Hello

eternal osprey
#

how come that?

earnest phoenix
#

someone could speak french

lusty quest
#

function calcCrow(lat1, lng1, lat2, lng2, lastcoordinate) { you can remove lastcoorinate here its not needed

eternal osprey
#

i can but this is only an english chat @earnest phoenix \

quartz kindle
#

@eternal osprey readFileSync("path","utf8")

eternal osprey
#

is that the correct way to do it? Why? Also what does path and utf8 refer to>

lusty quest
#

utf8 is the encoding

quartz kindle
#

path is the file path and name

#

like /myfolder/myfile.bla

eternal osprey
#

aha okay i got it

#

i could just use "./lastcoordinate.json"right

quartz kindle
lusty quest
#

yes

eternal osprey
#

but this wouldn't make sense right?

#

as my json file has 2 coordinates saved to it

lusty quest
#

why?

eternal osprey
#

lat1 and lng1

#

if i am const lat2 = readFileSync("./lastcoordinate.json","utf8")

#

it will get the whole lat1 +lng1

quartz kindle
#

yes

#

you need to process the file

pale vessel
#

what would integer path look like

quartz kindle
#

it would be a file descriptor @pale vessel

eternal osprey
#

hmm okay

#

or no

#

wait

#

but how would my lat2 be defined now then?

#

as i have taken the whole lat1 and lng1

#

and i only need the lat1

lusty quest
#

you can refer the file as const coordinates = fs.....
and then read it with coordinates.lat1

#

if your file structure matches to it

quartz kindle
#

console.log it after reading it

#

so you can see what it looks like

eternal osprey
#

ooowh okay.

#

i kinda get it now

quartz kindle
#

if its json, you can convert it, if its string, you can split it

#

according to your writeFileSync right above

#

it should be an array

#

you can use JSON.parse on it

eternal osprey
#

so json.parse(lat1) for example?

quartz kindle
#

if its being written as a comma delimited string instead, which is how arrays get automatically stringified, then you can split it by a comma

eternal osprey
#

so json.parse(lat1) for example?
@eternal osprey is this example right?

quartz kindle
#

console.log it and see

eternal osprey
#

okay on my way

opal plank
#

tim

eternal osprey
#

i tried doing it the way how superbrain8 told me, but it still gave me buffer shit

#

let me try it on your way

quartz kindle
#

erwin

eternal osprey
#

not erwin's icon is hot

opal plank
#

is it a wise move to store 25+ unique items in bits?

#

also ty

quartz kindle
#

your nitro expired? shes no longer dancing

opal plank
#

yup]

#

too poor for nitro

#

but fear not

quartz kindle
#

xD

#

what are these 25 unique items?

opal plank
#

anything really, im doing a bitwise field like discords for permission

#

though.... 25+ gets shit to the power of 2 really big

#

so im unsure if its a good idea to store that many items like that

quartz kindle
#

js can handle 48 bits as integers

#

bigger than that you need to use bigints

opal plank
#

so its viable until 48?

quartz kindle
#

technically yes

opal plank
#

even with those stupid numbers?

#

hmmmm

quartz kindle
#

you could also use bigints just to make sure

opal plank
#

i mean i know the shapw always

#

shape*

#

so it wont be returning anything bigger

#

rn i got 22 items that need to be mapped

eternal osprey
#

i still can't get it working!

opal plank
#

but i was checking and it was getting really big really quick post 25

eternal osprey
#

for fuck sakes

quartz kindle
#

actually js can handle up to 53 bits

#

JavaScript can only handle integer values up to a magnitude of 53 bits (the 52 bits of the fraction plus 1 indirect bit, via the exponent

opal plank
#

hmmmmm

#

i'll prob stick with that for this case

#

50 gives me plenty of room to play with for a bit

#

storing a user's configs in a single number is handy af

#

no need to create entries for the database for each thingy

quartz kindle
opal plank
#

just picturing a db table with 53 collums gives me a headache

quartz kindle
#

lmao yeah

opal plank
#

aight, imma go with that for now then

quartz kindle
#

there are databases out there with thousands of cols, can you imagine that

opal plank
#

i actually can cuz ive seen some with 100+

#

but still

#

shivers

quartz kindle
#

xD

opal plank
#

i usually unconsciously try to reach for my flamethrower to burn it the moment i see it

#

@quartz kindle enjoy cursed ts

cinder patio
#

the hell

grizzled raven
#

lol why did you censor that

opal plank
#

the world shall never know

grizzled raven
#

formatted ts doesn't even look cool i'm sorry

opal plank
#

its not about formatting, the content is worse

quartz kindle
#

lmao

eternal osprey
#

yeah sorry for being so dumb and persistant.

#
  timer = setInterval(async ()=>{
        if (raids.length > 0)
        {
          let raid = raids.shift();
          const name = getName(raid.pokemon_id);
          const lat1 = raid.lat;
          const lng1 = raid.lng.substring(1);
          fs.writeFileSync("./lastcoordinate.json", [lat1, lng1])
          console.log(name, + "\n" + raid.gym_name, + "\n" + raid.lat, + "\n" + raid.lng);
          
            
          const coordinates = fs.readFileSync("./lastcoordinate.json","utf8")
          const lat2 = fs.readFileSync("./lastcoordinate.json", coordinates.lat1)
          const lng2 = fs.readFileSync("./lastcoordinate.json", coordinates.lng1)
          console.log(lat1, lat2, lng1, lng2)

``` what the fuck
quartz kindle
#

i like the comment

opal plank
#

xD

eternal osprey
#

why the fuck is this returning bufferss still.

grizzled raven
#

readFileSyhx returns a buffer of the file

#

just do toString

#

easy

quartz kindle
#

what the fuck

#

is that code

opal plank
#

mine or awesome?

quartz kindle
#

awesome's

#

lmao

opal plank
#

can setInterval even run async?

quartz kindle
#

it can

#

@eternal osprey why are you reading the same file 3 times

opal plank
#

i remember having some issue with something of that sort and i cant remember what

#

can we just start by why not use a database?

eternal osprey
#

@quartz kindle yeah i am really just fucking up my code right now

#

@opal plank i know. It just saves 2 coordinates. It shouldn't be a big deal.

opal plank
#

hmmmm

eternal osprey
#

json is the worst of it's kind, but once used correct there cannot be much of an isse.

#

issue*

opal plank
#

hmmmmmmmm

eternal osprey
#

but atm i am just stuck with my code. It still returns me a fuckingg long list of bufferrs.

#

any suggestions?

opal plank
#

i cant remember buffers too well, i havent played with them for a couple months now

eternal osprey
#

hmm tostring?

earnest phoenix
#

how to i fix heroku cant connect to mongodb

opal plank
#

also

#

dood

#
          const coordinates = fs.readFileSync("./lastcoordinate.json","utf8")
          const lat2 = fs.readFileSync("./lastcoordinate.json", coordinates.lat1)
          const lng2 = fs.readFileSync("./lastcoordinate.json", coordinates.lng1)```
why
eternal osprey
#

yeah i am stupid

opal plank
#

just read the file once

eternal osprey
#

because coordinates gives the lat1 and ln1

opal plank
#

or better yet, store in memory

eternal osprey
#

i will try with tostring.

opal plank
#

aight, imma get to coooding

#

or whatever the fuck this noodle spaghetti bs is

quartz kindle
#

@eternal osprey dude... dont read the same file 3 times

#

read the file once

#

then do things to it

eternal osprey
#
     const coordinates = fs.readFileSync("./lastcoordinate.json","utf8").toString()
          const lat2 = coordinates.lat1
          const lng2 = coordinates.lng1
          console.log(lat1, lat2, lng1, lng2)

```i know that it is wong what i just wrote. The const coordinates will show the lat1,lng1 but how would i ever define lat2 and lng2
#

i know i know

quartz kindle
#

you dont need toString() if you use utf8

eternal osprey
#

someone just said that i had to use tostring

#

to return a string as it would be easier

quartz kindle
#

coordinates is not an object, you cant do coordinates.lat1

pale vessel
#

parse it

quartz kindle
#

console.log(coordinates) so you see what it is

eternal osprey
#

@quartz kindle it returns me : 40.752579,73.720396

#

which is good.

#

but how can i define lng2 and lat2

quartz kindle
eternal osprey
#

ah so lat2= coordinates[0] etc

#

aha i get it!

#

how can this ever be: 8353.165083512797 kilometers of distance?

#

between 40.628727, 74.02469 and 40.816857, 73.75716

#

my console.log

#

like wtf is this

#

@quartz kindle

#
 const coordinates = fs.readFileSync("./lastcoordinate.json","utf8").toString()
          const lat2 = coordinates[0]
          const lng2 = coordinates[1]
          console.log(lat2 + "\n" + lng2)

``` i've done everything you said
#

but uhhm

#

dafuq

#

it returns 4 and 0

opal plank
#

toString() returns, well, a string

#

what you are getting is the returned string position

#

aka string[position 0], string[position 1]

pale vessel
#

split the string by ,

#

and destructure it

eternal osprey
#

yeah i know

#

i have fixed it

#

but my function is still fucked up

pale vessel
#

const [lat1, lat2] = readFileSync().toString().split(",") or something

eternal osprey
#

Egg 0American Boy Statue 040.849534 0-73.82336 program.js:65 40.849534 //lat2 coordinate 73.82336 //lng2 coordinate program.js:72 0 program.js:97 Egg 0International Year Rock 040.600624 0-74.150802 program.js:65 40.600624//lat1 coordinate 74.150802//lng1 coordinate program.js:72 0//lastcoordinate (result)

#

how can the lastcoordinate ever be 0?

#
    
          function toRad(value) {
            return value * Math.PI / 180;
        
        }
        
        function calcCrow(lat1, lng1, lat2, lng2) {
            var R = 6371;
            var dLat = toRad(lat2 - lat1);
            var dLon = toRad(lng2 - lng1);
            var lat1 = toRad(lat1);
            var lat2 = toRad(lat2);
        
            var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
                Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
            var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
            var d = R * c;
            return d;
            
        }
        let lastcoordinate = calcCrow(lat1, lng1, lat2, lng2)```is this code wrong that i wrote?
#

is it using the wron variables?

#

i am really confused at this point

eternal osprey
#

what the fuck are you doing @mighty zealot

pale vessel
#

XD

wet nebula
#

Hi someone will advise me looking for discord bots that can do registrations

pale vessel
golden condor
#

It's .users.first()

pale vessel
#

also, just use members.first()

eternal osprey
#

anyone that knows the answer on my question?

pale vessel
#

you don't need to do guild.member(user) afterwards too

earnest phoenix
#

whats the full stack trace

tardy hornet
#
const msg = await message.channel.send(helpss);
await msg.react('๐Ÿ—‘๏ธ')
await msg.awaitReactions((reaction, user) => message.author.id == user.id && (reaction.emoji.name == "๐Ÿ—‘๏ธ"), {max: 1, time:15000})
.then(async collected => {
  if(collected.first().emoji.name == "๐Ÿ—‘๏ธ"){msg.delete(), message.delete()}
  else return message.channel.send("error")
})

sometimes it work and sometimes it dose not

outer perch
#

message.reply("that member isn\'t in the server") you can take off the \ in \' cuz the " does the quote and it doesn't affect the ' @earnest phoenix

#

only if the quote is inside ' '

#

if (memeber) { should be member instead of memeber

#

wait

#

send the error

#

read it, what does it say?

#

that's an error with Node.JS

#

you should check the dependencies

#

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

#

there must be more above all npm ERR!s

#

is there anything in the console?

#

above what you sent?

#

hmm

#

so the problem may be with reading the code and start it

#

lemme check again

#

yes

#

did u edit what I told you to?

#

this version is still the same before I told you anything

#

ah

pale vessel
#

fix this

outer perch
#

now we're talking xD

#

true

pale vessel
#

it's })

outer perch
#

member.kick('you were kicked from the server!') this is what concerns me

pale vessel
#

you might want to learn basic js first

outer perch
#

I don't think you can send messages to a member who's getting kicked like that

#

use this guide

#

it may help you

pale vessel
outer perch
#

really ._.

#

better the guide from the library than w3schools imo ๐Ÿค”

#

oh wait

#

LOL

#

now I noticed o_o

#

and never forget

#

always use let over var

#

๐Ÿ˜›

lusty quest
#

const also works

outer perch
#

const also works
@lusty quest const is for constant variable, if you want a changeable variable, u can use var, but let is better I forgot why ๐Ÿ˜ฎ

lusty quest
#

var is more or less deprecated and ignores the scope

outer perch
#

but wait

#

you know javascript or not?

lusty quest
#

ive got my Developer medal on discord with a D.js bot

#
You're right in saying there is no real advantage to using var over let - if you define them at the start of a function their meaning is basically identical.

You're right that there is no real reason to write new code using var (except maybe this, if relevant).

There are pages on the internet that are decades old though, and no one is going to rewrite them. There is nothing really to gain by removing var from the language. For languages like HTML and Javascript that are interpreted - backward compatability is absolutely mandatory.

That is also why they chose not to simply redefine var. Take the following example code;

// THIS IS AN EXAMPLE OF BAD CODE. DO NOT COPY AND PASTE THIS.
if (logic) {
    var output = "true"
} else {
    var output = "false"
}
console.log(output)
If var was changed to behave like let then the console.log would cause a reference error because of the scope difference.```
outer perch
#

so how can you have mistakes like that in your code?

lusty quest
#

did you smoked something?

tired panther
#

How can I paste a html code from a website , in the inbuilt code field on top.gg page, do the html code have a special format?

pale vessel
#

must have been some good shit

outer perch
#

did you smoked something?
@lusty quest sorry wrong guy

#

YIKES

#

the guy never said anything again

#

and I even thought he was wrinting

#

let's forget what just happened

#

How can I paste a html code from a website , in the inbuilt code field on top.gg page, do the html code have a special format?
@tired panther I guess CSS is the only thing you can customize there

tired panther
lusty quest
#

only html/css. scripts if you are certified dev

tired panther
#

how do they do such things? @outer perch

lusty quest
#

html

#

you can inspect the page and see what they have done

outer perch
#

so you can use html

tired panther
#

my html code does not work there

outer perch
#

k

lusty quest
#

not sure but it looks like it. (in a limited way)

outer perch
#

but, Certified Developer isn't being given to anyone now

#

at least from what I'm told

rustic nova
#

Correct

lusty quest
#

yea they want to revisit it i think

#

there where some reason

outer perch
#

so that means no one's getting free html/css xD

lusty quest
#

i never really worked with HTML/CSS so idk

rustic nova
#

Nah you can use html/css without certified developer

#

You can't use js though

tribal siren
#
            { name: `Prefix`, value: `${prefixes}`, inline: false },
            { name: `**Information Commands (${prefixes}help information)**`, value: 'lmao help', inline: false},
            { name: `**Moderation Commands (${prefixes}help moderation)**`, value: 'what', inline: false},
            { name: `**Fun Commands (${prefixes}help fun)**`, value: '``<meme`` ``<poll``'}
          )```
lusty quest
#

i think html also is limited in what is allowed. like you are not allowed to remove or overwrite ads

tribal siren
#

it says damn this error

#

TypeError: "" is not a function

#

what can i do

#

i tried EVERYTHING

lusty quest
#

'``<meme`` ``<poll``' i would guess this creates the error

#

you can escape them with \

tribal siren
#

so how can i correctly form that?

outer perch
#

'`<meme` `<poll`'

tribal siren
#
            { name: `Prefix`, value: `${prefixes}`, inline: false },
            { name: `**Information Commands (${prefixes}help information)**`, value: 'lmao help', inline: false},
            { name: `**Moderation Commands (${prefixes}help moderation)**`, value: 'what', inline: false},
            { name: `**Fun Commands (${prefixes}help fun)**`, value: 'oml'}
          )```
#

now i got this

outer perch
#

yikes

tribal siren
#

TypeError: "" is not a function

outer perch
#

Discord escapes the characters too xD

lusty quest
#

well you need a codeblock

tribal siren
#

i will do the fields all over again lmao

lusty quest
#

@tribal siren are you sure its this part of the code that errors out?

outer perch
#

i will do the fields all over again lmao
@tribal siren don't

tribal siren
#

yes

lusty quest
#

send the entire code. if its to long use hastebin or something like it

outer perch
#

the problem isn't there

#

it must be anywhere else

tribal siren
#

i just finished doing a customizable prefix command and this pops out

#

wait lemme do some stuff

#

i will refer here if a problem occurs again

outer perch
rustic nova
#

Html css and markdown allowed

#

JavaScript will be removed

#

Exactly what i said, yeah

lusty quest
#

yea i know but its almost a year ago that i used it the last time

earnest phoenix
#

anyone know how to fix: TypeError: Cannot read property 'guild' of undefined
the line is: const MOD_CHANNEL = member.guild.channels.cache.find(ch => ch.name === 'botlog');

pale vessel
#

member is undefined

earnest phoenix
#

V

pale vessel
#

where did you define member?

earnest phoenix
#

here

#

run: async (client, message, member, guild) => {

pale vessel
#

don't repost that closebruh

#

ic

#

is this an event?

#

or sorry, can you show your command handler code?

earnest phoenix
#

no a cmd

#

its for a banlog command

pale vessel
#

did you provide member and guild?

earnest phoenix
#

in the handler

pale vessel
#

because it could just be client and message

earnest phoenix
#

i did not use the other 2 nmo

#

no

#

what would i type to define member

pale vessel
#

message.member for the author as a member

#

message.guild for the message's guild

earnest phoenix
#

its not a message its on ban report the ban to the MOD_CHANNEL

#

How can i get mongodb ping?

#

like this?

#

mongoose.connection.on(connecting, () => {
console.log(([${name}-WARN])} : Connecting to MongoDB server...`)
});

#

No, not that like the connection ping? Not sure what its called

#

im not sure

#

do u know this

#

anyone know how to fix: TypeError: Cannot read property 'guild' of undefined
the line is: const MOD_CHANNEL = member.guild.channels.cache.find(ch => ch.name === 'botlog');

#

try logging the member and see if it has the guild property

pale vessel
#

no because member is undefined

#

it's not even an object closebruh

earnest phoenix
#

which event is that?

#

what should i type to define member

#

its unban

#

and yes it is hoggers

#

client.on("guildBanRemove", function(guild, user, member) {
const MOD_CHANNEL = member.guild.channels.cache.find(ch => ch.name === 'botlo');

#

unban event?

#

guildBanRemove doesn't provide member property

#

ohhh

#

so just do guild.channels....

#

ima test

#

and there is no member object since they aren't in the guild

#

return client.channels.cache.get(MOD_CHANNEL).send(embed);
^

TypeError: Cannot read property 'send' of undefine

#

log the channel

#

wdym

sudden geyser
#

The channel couldn't be found in the cache.

earnest phoenix
#

doesn't djs cache all channels?

sudden geyser
#

.get takes a channel ID for the record

earnest phoenix
#

already found it in cache before that lite

sudden geyser
#

not a channel object

#

oh

earnest phoenix
#

i don't remember since I'm using eris

#

I GOT IT TO WORK

#

read the docs next time

#

i just did return MOD_CHANNEL.send(embed)

#

yh ik

#

lol

#

thanks

#

Does someone has a neath porn command

#

Or a api

#

I need a api

#

for pussy, sex, anal, blowjob, 4k, hentai

rustic nova
#

T_memesadkek best is to search that for yourself

earnest phoenix
#

@rustic nova Bro, I searched for days

#

but i cant find

#

such a good api

#

@earnest phoenix const { API } = require('nhentai-api')

pale vessel
earnest phoenix
#

self bots against tos

#

@modern sable

#

He buys selfbot

#

please act

#

@zealous sable

#

Alex is always active

#

he will assist us

rustic nova
#

Pinging one is good enough

lusty quest
#

now you pinged 2 people that cant do anything

earnest phoenix
#

No i can ping 2

zealous sable
#

Hi

#

Whats up

earnest phoenix
#

Someone asks for selfbot

#

scroll up

rustic nova
#

Dude trying to ask for selfbot programming

zealous sable
#

I will leave it to a mod

rustic nova
#

I'm looking for a bot to send a private message and invite it to the server
will pay?her style selftboot
@SeGo#8743

earnest phoenix
#

Yes

modern sable
#

@earnest phoenix selfbotting is against Discord ToS

#

so we wont assist you with that

earnest phoenix
#

We also dont sell

rustic nova
leaden rover
#

First off @earnest phoenix, bot reviewers don't have perms to ban or whatever

earnest phoenix
#

O

leaden rover
#

crap, I'm late DX

earnest phoenix
#

But Alex should be moderator

#

I vote

leaden rover
#

Sorry, I just sniped this channel lmao

modern sable
#

and also you will quickly get banned from Discord if you send lots of DMs at once so just dont

earnest phoenix
#

But dont mini mod

leaden rover
#

ANYWAYS, let's get on topic lol

earnest phoenix
#

I need porn api

#

that is why im here

#

i cant google

#

because my parents dont like that

leaden rover
#

We, can't help with NSFW?

earnest phoenix
#

O

leaden rover
#

well idk tbh

lusty quest
#

we can but we should not

earnest phoenix
#

Please help me

#

I need it for my bot

leaden rover
#

Is it an NSFW bot?

earnest phoenix
#

It would be very very nice if someone could help me

#

Its not an nsfw bot

leaden rover
#

oh ok

earnest phoenix
#

its a fun bot

#

with nsfw

#

@modern sable

#

He does again

leaden rover
#

@earnest phoenix like we said, NO SELF-BOT development.

lusty quest
#

@green kestrel i guess this is something for you

earnest phoenix
#

Please act but now good

#

No no no no

rustic nova
lusty quest
#

i guess he is gone

earnest phoenix
#

Thanks

#

Yes I saw modlog

rustic nova
#

Back to development talk KEKW

earnest phoenix
#

Yes

#

Ok so I need porn api

finite bough
#

no one is gonna make a bot for u free

earnest phoenix
#

i already found this

finite bough
#

.-.

earnest phoenix
#

but i need key

#

to access

#

I also got a key, but were do i fill that?

lusty quest
#

use a open one

earnest phoenix
#

I use node fetch

modern sable
#

No NSFW content

earnest phoenix
#

O, sorry

finite bough
#

marco are anime body pillows safe for work?

earnest phoenix
#

Can I ask for api?? Or also not

#

@finite bough they are nsfw imo

finite bough
#

dont say that u hurt marco's feelings

earnest phoenix
#

Ooo

#

Did i do something wrong??

#

I am very sorry

lusty quest
#

there are API clients for this stuff. if you search for it in on the npm website you will find stuff

modern sable
#

@finite bough well as long as the image is SFW yea

#

but no NSFW pillows lmao

earnest phoenix
#

I found pornhub

#

api

#

but that aint working

lusty quest
#

but with nsfw commands you will not get the Bot verified here

#

nekos.life is a website they have sfw endpoints and nsfw endpoints (the later one can get you in trouble bcs some of the stuff is yikes)

earnest phoenix
#

I found this one

pale vessel
#

nice

earnest phoenix
#

But please tell me if its allowed

#

to be accepted

north birch
#

I think so

earnest phoenix
#

I dont want my bot gets declined

rustic nova
#

As long as it is restricted to nsfw channels

pale vessel
#

yes, if you lock it to nsfw channels only and don't mention the comamnd in your bot description

earnest phoenix
#

Yes ofc

#

yes yes yes

#

all i got that

rustic nova
#

Also, don't mention it on your bot page because that will get your bot denied

earnest phoenix
#

K

lusty quest
#

nsfw bots that mainly promote nsfw stuff will be declined. if you got nsfw commands they should not be mentioned on your Top.gg page and needs to be limited to nsfw channels

earnest phoenix
#

I got another problem

#

I cant test it

#

because im younger then 18

lusty quest
#

well then no nsfw commands for you

earnest phoenix
#

lol

#

Im sad

#

Bro my bot needs it

lusty quest
#

write a command and when you are done limit it to nsfw channels

rustic nova
#

if you're under 18, don't implement nsfw stuff in it

boreal iron
#

lmao thatโ€™s where we got in 2020

rustic nova
#

Make a generic bot that doesn't have nsfw yet

#

Not saying that it isn't allowed or anything

#

But best to not implement it yet

lusty quest
#

make a hidden nsfw command that is nowhere listed and then join random servers where your bot is in and use the command to confuse everyone

north birch
#

LMAO

rustic nova
#

You aren't allowed to make invites through your bot btw

lusty quest
#

you check if the Server is listed somewhere

#

you can get the name pretty easy like you have a automatic posting of Guilds where your Bot joins or leave

north birch
#

PornHub Kids

lusty quest
#

joke aside like i said they wont allow pure NSFW bots but if you have one or two nsfw command and they are not listed on the top.gg page and are limited to nsfw channels it should be fine

earnest phoenix
#

OMG

#

my bot is now pornhub wtf

north birch
#

LMAO

earnest phoenix
#

It sends soo much porn

#

and it also did this:

#

oh nvm

#

Undefined

#

not so good

#

i cant send link

rustic nova
#

I still suggest not implementing it yet

north birch
#

HAHAHAHAHAHA

It sends soo much porn
@earnest phoenix

earnest phoenix
#

Bro

#

Fr

#

I test it on a message event

#

without nsfw block

#

and it reacted to itselfs

#

and the bot is already in 80 servers

#

i am scared it spammed porn in there

north birch
#

lmaoooooooooooooooooooooooooooooooo

earnest phoenix
#

No not lmao

#

How to delete all messages the bot has send

north birch
#

Well HAHAHAHAHAH

earnest phoenix
#

This is NOT GOOOD

lusty quest
#

this is why you dont develop on a Live system

earnest phoenix
#

NO

#

Bro i cant help it

north birch
#

LMAOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

earnest phoenix
#

i fked it up

#

Im a shit developer

#

i will quit

#

thats the best

#

my bot is fked up

#

who pinged me

north birch
#

No dont worry

Im a shit developer
@earnest phoenix

earnest phoenix
#

I am for real

#

it sended 100+ porn gifs

lusty quest
#

better than the dude who ran a eval that made his bot leave every Server it where in (he got over 300 before)

earnest phoenix
#

in a not nsfw channel

north birch
#

HAHAAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH

earnest phoenix
#

@lusty quest How dumb can you be??

lusty quest
earnest phoenix
#

but i think this is also dumb

north birch
#

better than the dude who ran a eval that made his bot leave every Server it where in (he got over 300 before)
@lusty quest LMAOOOOOOOOO

earnest phoenix
#

Bro

#

i dont know

#

how many damage this is

#

it sended mass porn in not nsfw channels

lusty quest
#

if you search a half year worth of posts in #starboard you maybe find it

earnest phoenix
#

ok

#

it got removed already out 4 servers

#

i fked my bot up

#

I will just quit

#

its the best

north birch
#

NO DONT QUIT PLEASE YOU DESERVE THE WORLD FOR MAKING ME LAUGH SO HARD

earnest phoenix
#

It was not even fun

#

i made people see porn

#

that didnt wanted it

lusty quest
#

@earnest phoenix to prevent this stuff make a 2nd bot account at the Discord developers page. use the 2nd bot for development

earnest phoenix
#

Ok

#

But i do local host

#

my pc cant handle 2 instances

lusty quest
#

if you fuck it up again it will just spam in one Server not 80

earnest phoenix
#

Yes that is true

lusty quest
#

lol my raspberry can handle more

earnest phoenix
#

that is sick

#

how much it costs

lusty quest
#

50$?

#

probably cheaper now

#

since its a B3+

north birch
#

@earnest phoenix You probably get some people horny not that bad

fringe ivy
#

Ur.....mm

earnest phoenix
#

this pc costed 27$, but it was on alixpress, my dad dont wanted to buy me a good one

north birch
#

OH

#

27$ Cost my mircowave

earnest phoenix
#

It was very cheap

#

and it starts up

#

Why i cant click the star

#

on my message

#

Its very sat

boreal iron
#

Please keep in mind youโ€™re in development not #general

earnest phoenix
#

Ok

#

I was talking about development

#

and about instances

#

but ok

#

another person that thinks im a shit developer

slender thistle
#

Stop being a drama queen

pale vessel
#

lmao imagine suddenly seeing a bot you added send 5000 porn for no reason

north birch
#

LMAOOOOOOOOO

#

He need to get in the starboard now lmao

vale garden
#

hi

lusty quest
#

hi

cinder patio
#

instant no nut November fail

north birch
#

instant no nut November fail
@cinder patio HAHAHAHAHAHAHAHAHA

#

Hello Multi

#

instant no nut November fail
@cinder patio AntiNNN Bot

earnest phoenix
#

const Pornsearch = require('pornsearch').search('WHAT YOU WANNA SEND');


Pornsearch.gifs()
  .then(gifs =>{
    var result = gifs[Math.floor(Math.random() * gifs.length)];
    console.log(result.url) //Is your finally gif result
  })
#

Thank me later

vale garden
#

does anyone how you can create an invite in a server the bot is in

earnest phoenix
#

This is porn command

#

Can someone pin it, so no one has to ask for it anymore

unique nimbus
#

oh my

north birch
#

@earnest phoenix How many server banned your bot for that spam? lmao

earnest phoenix
#

7

#

now

north birch
#

Shit XD

vale garden
#

does anyone how you can create an invite in a server the bot is in
@vale garden

#

anyoneee

lusty quest
#

its not really allowed

rustic nova
#

That's a privacy breach

earnest phoenix
#

We dont help

rustic nova
#

not allowed

earnest phoenix
#

With that

vale garden
#

oh

lusty quest
#

you could get the name and google if they are public

rustic nova
#

unless your bot user asks for it, like doing "!createinvite"

vale garden
#

yea

rustic nova
#

but you are not allowed to get these invites through !createinvite for example and use them yourself

vale garden
#

i need it for that

#

cuz

#

oh kk

#

so how do i make the command tho

rustic nova
#

unless it's mentioned that you can join through it, but I'm not 100% sure if that's allowed

#

ask a mod on that

earnest phoenix
#

message.channel.createInvite().then(invite =>{

message.channel.send(invite.code)
})

#

here big spoonfeed

vale garden
#

lol ok tq

earnest phoenix
#

It works

#

I coded taht in 10 secs

vale garden
#

lol

earnest phoenix
#

if you were smart you also could

#

it isnt very hard

#

Also I made porn working now

vale garden
#

yea but i didnt know that createInvite() existed

#

so

earnest phoenix
#

docs

vale garden
#

wtf would i have done

earnest phoenix
#

O it does exists

vale garden
#

lol ok

earnest phoenix
#

I can use here nice emoji

#

^^ Spoonfeed

#

๐Ÿ˜

#

should I do 10 seconds on porn command

#

or longer

north birch
earnest phoenix
#

I dont want they cum on my bot

#

thats awful

north birch
#

HAHAHAHAHAHAHAHAHAHHAHA

earnest phoenix
#

I will do 3 minutes cooldown on porn command

#

that is best

lusty quest
#

@earnest phoenix would recommend to talk about less nsfw stuff since there are still rules here and here are still users that are not legal age

north birch
#

No dont add cooldown, i dont think they will like that

earnest phoenix
#

Oh

#

ok??

#

That is best

#

Now i will stop about this topic

#

Imagine letting your bot leave all servers

#

๐Ÿ˜ฎ

pale vessel
#

right, "pin" a porn command lul

earnest phoenix
#

that is not soo good

#

@pale vessel Yes, people really need it and no one knows how to make

#

so this is such a good idea

#
module.exports = {
    name: 'args-info',
    cooldown: 5,
    aliases: ['icon', 'pfp'],
    description: 'Information about the arguments provided.',
    execute(message, args) {
        if (!args.length) {
            return message.channel.send(`You didn't provide any arguments, ${message.author}!`);
        } else if (args[0] === 'foo') {
            return message.channel.send('bar');
        }

        message.channel.send(`Arguments: ${args}\nArguments length: ${args.length}`);
    },
};
#

this was my first command

pale vessel
#

Nice

earnest phoenix
#

but that was with discordjs guide

#

they gave me this all

#

๐Ÿ˜‚

#

i didnt made it

#

i copied pasta

north birch
#

Pasta

earnest phoenix
#

My first self written command was:


export const description = "Info, Harry Potter Characters";

exports.run = (client: Client, msg: Message, args: Array<string>) => {
    if (args[0] == null || args[1] == null)
        return msg.channel.send('Pleae provice a Harry Potter charachter')

    fetch("https://hp-api.herokuapp.com/api/characters").then(resp => {
        return resp.json()
    }).then(data => {

        let character;
        
        data.forEach(item => {
            if (item.name.toLowerCase() == args[0].toLowerCase() + " " + args[1].toLowerCase()) {
                character = item;
            }
        });

        if(!character) {
            return msg.channel.send(`${args[0] + " " + args[1]} was'nt found! I'm so sorry!`)
        }

        if (character.wand.length === '') {
            character.wand.length = '-'
        }

        if (character.wand.wood === '') {
            character.wand.wood = '-'
        }

        if (character.wand.core === '') {
            character.wand.core = '-'
        }

        let embed = new MessageEmbed()
        .setTitle(`Information ${args[0] + " " + args[1]}`)
        .addField('**House**', `${character.house}`)
        .addField('**Date of Birth**:', `${character.dateOfBirth}`)
        .addField('**Wand**', `Wood: ${character.wand.wood} \n Core: ${character.wand.core} \n Length: ${character.wand.length}"`)
        .setThumbnail(character.image)
        .setColor(character.eyeColour.toUpperCase())

        msg.channel.send(embed)
    })

}

``` lmao
rustic nova
#

@grave yoke use css inside your long description through <style> tags

earnest phoenix
#

Bro whats that

rustic nova
#

to get the selectors (the names of the objects like the button for example), use inspect element

earnest phoenix
#

Bro whats that
epic harry potter information

grave yoke
#

ok but ฤฑ want to do gif

rustic nova
#

a gif background? use background-image then

#

but remember to not use gifs that could cause seizures

grave yoke
#

ok

#

ฤฑ'll try

lethal grail
#

how do i check the uptime of a bot using eval

stable nimbus
#

@umbral zealot Hey mate, I figured my issue out. Apparently I was calling my db connection args instead of the actual DB connection. Soooo it was me being an idiot.

cinder patio
#

Why do you want to use eval?

stable nimbus
#

Just make an uptime command?

lethal grail
#

thats tiring but ok

#

i just started js today and im trying to learn

pale vessel
#

process.uptime()?

cinder patio
#

Um... using eval you would place the same code for the command inside a string, so I don't really see the difference... lol

#

except it'll be slower, of course.

grave yoke
#

@rustic nova its not worked

stable nimbus
#

I found one on the internet that will give exact time as long as it functions.

rustic nova
#

what does not work?

grave yoke
#

background

stable nimbus
#

...

rustic nova
#

you need to get the css selector for the background

grave yoke
#

how can ฤฑ get it ?

boreal iron
#

background-image: url('img');

rustic nova
#

they need the css selector of the background

boreal iron
#

oh

#

for which element?

#

the content?

slate oyster
#

Do webhook bypass the global ratelimit? Meaning you only have to deal with local ratelimit? Regardless of the answer, I was planning to add webhook support for a certain feature of my bot, but I was just curious

rustic nova
#

webhooks from like voting? don't think so

#

as you get the request, not send them

slate oyster
#

I meant, if you use MANAGE_WEBHOOKS to create a webhook, and then post to that webhook

rustic nova
#

oh discord webhooks

#

yes they do

#

give me a minute

#

you could make a test request to a webhook through a rest client and get the ratelimits for the webhooks

slate oyster
#

Thanks!

rustic nova
slate oyster
#

I was planning to add (optional) webhook support for a certain feature
Primarily, to add nickname and pfp, sending support.
But I was also worried that the same feature could use up a ton of global ratelimits
So I was curious if webhooks would help

earnest phoenix
#

OMG!!

#

I got the rapid porn api

#

This will make my bot great

pale vessel
#

get some help

earnest phoenix
#

What???

slender thistle
#

Stop talking about anything related to porn

#

๐Ÿ™ƒ

earnest phoenix
#

Shivaco

rustic nova
#

shiv qt yandLove

slender thistle
#

no u

earnest phoenix
#

Code is stupid

#

where is your libary developer role

slender thistle
#

somewhere

earnest phoenix
#

it is gone

#

bro please be a mod again

#

your the best

hollow sedge
#

simp

pale vessel
#

development moment

earnest phoenix
#

wait SIMPS

#

where is SIMP

#

I kill all of the SIMPS

slender thistle
#

That feeling when Git refuses to stash changes

earnest phoenix
#

Im not a simp

#

haha

rustic nova
lethal grail
#

anyone know how to make a kick or ban command? js

rustic nova
#

you can make 5 requests at once (like the global ratelimit) and the reset is around 10 Seconds or so

#

so pretty much very similar to normal message ratelimits

slate oyster
#

Thanks!

lean wing
#

hello i created a html code for my bot but the top.gg is not reading the style

#

how can i fix it?

opaque seal
#

I really need help, I have no idea on what to do this
Basically I want to create a channel at the beginning of a category, how can I do that?

#

(voice channel)

north birch
#

What's wrong here?

if(isSomethingEquipped === true) {return message.channel.send('You have something else already equipped')};
message.channel.send('You equipped Weapon1');
db.set(`${message.author.id}_equipweapon`, 'Weapon1');
weapequip = db.fetch(`${message.author.id}_equipweapon`)
const filtro2 = weap2;
const newweap2 = filtro2.filter(weap2 => weap2!= weapequip);
weap2.set(`${message.author.id}_weapon`, newweap2)}
          }```

Error code:

```(node:2608) UnhandledPromiseRejectionWarning: TypeError: filtro2.filter is not a function```

I got the error, im stupid lmao, weap2 is the table so the correct filter should be:

```const filtro2 = weapget2;
const newweap2 = filtro2.filter(weap2 => weap2!= weapequip);```
earnest phoenix
#

everything is wrong with that code

north birch
#

Oh

#

Nice to hear

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

north birch
#

Veery nice

opaque seal
#

I really need help, I have no idea on what to do this
Basically I want to create a channel at the beginning of a category, how can I do that?
is this even possible?

north birch
#

@sage bobcat @earnest phoenix May i ask why and what can i do?

lethal grail
#
    name: "slowmode",
    description: "Lets you set slowmode on the channel.",
    run: (client, message, args) => {
        const amount = parseInt(args[0])
        if(message.member.hasPermission("MANAGE_CHANNEL"))
        if(isNaN(amount)) return message.channel.send("It doesn't seem to be valid number")
        if(args[0] === amount + "s") {
        message.channel.setRateLimitPerUser(amount)
        if(amount > 1) {
        message.channel.send("slowmode is now " + amount + " seconds")
        return
        }
        else {message.channel.send("slowmode is now " + amount + " second")
        return }
    } if(args[0] === amount + "min") {
        message.channel.setRateLimitPerUser(amount * 60)
        if(amount > 1) {
        message.channel.send("slowmode is now " + amount + " minutes")
        return
        } else { 
            message.channel.send("slowmode is now " + amount + " minute")   
             
    
    return }
    } if(args[0] === amount + "h") {
        message.channel.setRateLimitPerUser(amount * 60 * 60)
        if(amount > 1) {
        message.channel.send("slowmode is now " + amount + " hours")
        return
        } else {
            message.channel.send("slowmode is now " + amount + " hour")
        return}
    } else {
        message.channel.send("You can only set seconds(s), minutes(min) and hours(h)")
    }

    }
}
boreal iron
#

List all channels, head to the category you want to and add a channel above the channel with it's parent id being the category

opaque seal
#

The problem @boreal iron is that I already have a VC at position 0, and if I set the new vc at position 0 it goes to the bottom of the already existing one

boreal iron
#

Did u set a correct position?

opaque seal
#

yes

#

It can't be below 0

#

so I set it to 0

#

but having the same position to the other VC it goes to its bottom

boreal iron
#

Then edit all channels of this category by increasing their position + 1

#

Creating the new channel after

opaque seal
#

That's api spam I think