#development

1 messages Β· Page 1395 of 1

rich ether
#

but it was sending the embed and the txt

lyric mountain
#

I see

rich ether
#

so after he sent me his version i tweaked it a little to match the top code and boom it works like a charm

lyric mountain
#

Nice

rich ether
#

yuh

#

ill resubmit my bot ass soon as i finish my ai and ect

lyric mountain
#

Maybe we could play tcg someday lul

rich ether
#

ofc g

lyric mountain
#

Just kidding, you'd not understand a thing since it's br

rich ether
#

lmfapp

#

mabey i could help u with that ai though πŸ˜‰

lyric mountain
#

Sure, always open for knowledge

#

Gonna sleep now, see ya

rich ether
#

see ya

unborn ridge
#

.addField('Text Channels',`${message.guild.channels.filter(m => m.type === 'text').size}`,true)

#

message.guild.channels.filter is not a function

molten yarrow
hollow sedge
#

:o since when did this server have replies

haughty bough
#

Hello, How do I identify if a user manually kicked the bot?

earnest phoenix
#

Check Server logs

umbral zealot
#

I mean you can't if the bot's been kicked. So no, you can't know.

solemn pawn
#

Error: Cannot find module '/app/index.js' at Function.Module._resolveFilename (module.js:548:15) at Function.Module._load (module.js:475:25) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3
Bunun hatasΔ±nΔ± bilen varmΔ±?

#

Help me

#

@molten yarrow

umbral zealot
#

sounds like there's no file called /app/index.js

#

note that / at the start means "at the root of the drive" in the case of a package.json

#

you might want to do ./app/index.js instead.

solemn pawn
#

okey wait 1 minute

#

am trying

#

What should I write in /app/index.js

#

@umbral zealot

umbral zealot
#

uhhhh your bot?

solemn pawn
#

?

#

:d

umbral zealot
#

why are you trying to run a file if you don't know what to write in it???

solemn pawn
#

But am new coder 😦

umbral zealot
#

Ok well if you want to make a bot, here's how:
Step 1) learn a programming language
Step 2) choose a library in that language
Step 3) actually start writing the bot
Step 4) ask for specific help if you need it

solemn pawn
#

πŸ†— πŸ‘Œ okeh πŸ™†β€β™‚οΈ

hollow sedge
#

@drifting wedge well you could use bot.wait_for or the on_reaction_add event and check if the reaction was added to a giveaway message

drifting wedge
#

So basically I need the users Id and the server it was run it

#

But only for specific messages

#

Like so for example, when user joins giveaway, it dms them, saying giveaway joined etc

#

Ping pls

hollow sedge
#

Hm..I'm not sure what the best way to handle this is

#

Yeah sorry @drifting wedge I can't help you because I haven't personally worked with giveaways, so I don't know the most efficient message . I suggest doing some research and checking out other giveaway bots on GitHub

solemn pawn
#

@umbral zealot

#

I solved the problem and now my bot is active but it doesn't write to any channel

#

@umbral zealot

delicate shore
#

Can anyone guide me using nginx for sub domains

#

Actually idk anything about nginx

#

Can you guide from starting

gentle lynx
#
    at RequestHandler.execute (C:\Users\Administrator\Desktop\Almas V2\node_modules\discord.js\src\rest\RequestHandler.js:93:15)```
#

i still get this error

#

didnt the api issue get fixed

wide summit
#

Must i add somethink special to my bot that on the top.gg website the server count work?

lethal grail
#

yeah?

gentle lynx
#

soooo

#

is this an issue with my bot or discord api?

ebon dune
#
const Command = require("../../Base/Command");
const ms = require('ms');


class Timer extends Command {
    constructor(client) {
        super(client, {
            name: "timer",
            description: "Start a timer",
            usage: ["timer <timer>"],
            aliases: ["tstart"]

        });
    }

    async run(message, args, Discord) {
        
  const setTimer = new Discord.MessageEmbed()
        .setTitle("Timer")
        .setColor("RANDOM")
        .setDescription(`Timer set for: ${args} seconds`)
        message.channel.send(setTimer)
        function Timer(){
            const timer = new Discord.MessageEmbed()
            .setTitle("Timer Ended")
            .setColor("RANDOM")
            .setDescription(`Timer of ${message.member.displayName} ended, duration: ${args} seconds`)
            message.channel.send(timer)
        }
        setTimeout(Timer, args * 1000)
    }
};

module.exports = Timer;
``` i just want this to edit time every 5s
hasty mulch
#

What errors are you getting?

ebon dune
#

nothing

#

i just want it

#

to edir

#

edit

#

timer

#

every 5s

hasty mulch
#

Then you are probably getting rate limited

ebon dune
#

bro, i have not setup

#

the

#

editing

#

system

#

that what i need and i am here for

#

@hasty mulch

lethal grail
#

is there any reason why my avatar command stopped working when i got a new database

ivory seal
#

let user= client.users.cache.find(user => user.id === `${vote.user}`);
vote.user is an id but for some reason it comes undefined please help

frail ocean
lethal grail
#

i fixed it,

#

but thanks.

earnest phoenix
#

hello once a month this error occurs and my stick does not respond to anything until i restart it and it is very, very disturbing but I have no idea why you are doing it and what the solution would be for me please help

ERROR LOG

0|yue-chan |     at RequestHandler.execute (/var/www/html/system/servers/discord                                                                 /yue/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
0|yue-chan |     at runMicrotasks (<anonymous>)
0|yue-chan |     at processTicksAndRejections (internal/process/task_queues.js:9                                                                 7:5) {
0|yue-chan |   code: 500,
0|yue-chan |   method: 'post',
0|yue-chan |   path: '/channels/742774086442287165/messages'
0|yue-chan | }
0|yue-chan | HTTPError [AbortError]: The user aborted a request.
0|yue-chan |     at RequestHandler.execute (/var/www/html/system/servers/discord                                                                 /yue/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
0|yue-chan |     at runMicrotasks (<anonymous>)
0|yue-chan |     at processTicksAndRejections (internal/process/task_queues.js:9                                                                 7:5) {
0|yue-chan |   code: 500,
0|yue-chan |   method: 'post',
0|yue-chan |   path: '/channels/742774086442287165/messages'
0|yue-chan | }
ivory seal
#

whats ur code?

earnest phoenix
#

i don't know which code is the error

ivory seal
#

i mean does this error come when u start the bot or when u do a command?

earnest phoenix
#

completely random not knowing what makes you sure not to boot

#

for me the bot has been running fixed for 1 month without stopping and it's just so random from one moment it happens and I notice the next day because I did sleep when the error happened

green kestrel
earnest phoenix
#

Why @green kestrel

#

lol

green kestrel
#

scale

earnest phoenix
#

hmm

green kestrel
#

there were too many servers on each cluster again so i had to double them once more

#

should now be on until about 80,000 servers, which i'll probably not reach tbh

#

but never say never

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:10})
.then(async collected => {
  if(collected.first().emoji.name == "πŸ—‘οΈ"){msg.delete(), message.delete()}
  else return message.channel.send("error")
})

error:
TypeError: Cannot read property 'emoji' of undefined

earnest phoenix
#

the beautiful back yes i never say never

#

@tardy hornet enter the name of the emoji

tardy hornet
earnest phoenix
#

\πŸ—‘οΈ

pale vessel
#

10 milliseconds amandathink

earnest phoenix
#

\:wastebasket:

tardy hornet
#

the word emoji is undefine not the actually emoji

earnest phoenix
#

then I don't know how it just worked for me

rocky hearth
#

@tardy hornet I already told you to put time to 15000.
the promise is being resolved immediately. And hence have nothing in collected.first()
If you want to produce error on timeup. you can also set that too

pale vessel
unborn ridge
#
const axios = require('axios');
const { MessageEmbed } = require("discord.js");
module.exports.help = { 
    name: "emoteinfo",
  
}
module.exports.run = async (bot, message, args) =>  {
    if (!args[0]) return message.channel.send("No emoji was provided")
    let emoji = message.guild.emojis.cache.get(args[0]) 
    emoji = message.guild.emojis.cache.get(emoji.id)
    if (!emoji) return message.chinoReply("Emoji not found")
    

    let embed = new MessageEmbed()
  .setColor('RANDOM')
    .setThumbnail(emoji.url)
    .addField("Emoji Name", `\`${emoji.name} \``, true)
    .addField("Emoji Id", `\`${emoji.id}\``, true)
    .addField("Emoji Added on ", moment.utc(emoji.createdAt).format("LLLL"), true)
.addField("Emoji Animated?", animated, true)
  
    .addField("Download", emoji.url, true)

    message.channel.send(embed)
} ```
#

this never works for me]

#

//"-"\\

molten yarrow
unborn ridge
#

CAnnot find id of undefined

rocky hearth
#

what actually args[0] is?

unborn ridge
#

?

rocky hearth
#

an id or emoji itself?

unborn ridge
#

emoji

rocky hearth
#

then u r doing it wrong.

#

get accepts only ids, here

unborn ridge
#

how should i do then

rocky hearth
#

u can find emoji by name

lethal grail
#

@deep hearth what do you use to host your bot lmao

unborn ridge
#
const axios = require('axios');
const { MessageEmbed } = require("discord.js");
module.exports.help = { 
    name: "emoteinfo",
  
}
module.exports.run = async (bot, message, args) =>  {
    if (!args[0]) return message.channel.send("No emoji was provided")
    let emoji = args[0]
    emoji = message.guild.emojis.cache.get(emoji.id)
    
    

    let embed = new MessageEmbed()
  .setColor('RANDOM')
    .setThumbnail(emoji.url)
    .addField("Emoji Name", `\`${emoji.name} \``, true)
    .addField("Emoji Id", `\`${emoji.id}\``, true)
    .addField("Emoji Added on ", moment.utc(emoji.createdAt).format("LLLL"), true)
.addField("Emoji Animated?", animated, true)
  
    .addField("Download", emoji.url, true)

    message.channel.send(embed)
} ```
#

@rocky hearth

#

still error

rocky hearth
#

omg, not like that

unborn ridge
#

pls can u edit the message

rocky hearth
#
const emoji = message.guild.emojis.cache.find(emj => emj.name == args[0]);
unborn ridge
#

node:13080) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'url' of undefined

#

in set thumbnail line

#

@rocky hearth

rocky hearth
#

only custom emojis have a url, though

unborn ridge
#

its custom

rocky hearth
#

try, logging emoji

unborn ridge
#

and animated

#

i tried removing thumbnail now saying cannot find name of undefined

#

@rocky hearth

#

pls

#

😣

molten yarrow
hasty mulch
#

Altimeter: {'repr': 'A3060', 'value': 30.6, 'spoken': 'three zero point six zero'}
How do I grab the value of this JSON output?

#

Using Python

earnest phoenix
hasty mulch
#

@earnest phoenix That really doesn’t help me, cause I have response.json()['altimeter'] already

earnest phoenix
#

what about response.json()['altimeter']['value']

#

that's also a dict, isn't it?

hasty mulch
#

Oh, ok

#

My first time using JSON

earnest phoenix
#

i mean, it's just as easy as working with dicts

feral aspen
#

website.com/lol

#

What do you call the lol part in the cPanel?

safe creek
#

What does the input thingy for discord py mean? Does it mean the user has to input an word or letter I put after doing input?

gentle lynx
#

is the api issue still not fixed?

#

i still get an error everytime i run my bot.

gaunt skiff
#

I'am From Turkish

steep sun
#

How to put an attachment into an image of an embed?

hearty horizon
#

ok

manic osprey
#

@hearty horizon see

hearty horizon
#

ahhh yes

#

see what

manic osprey
#

begin
ClearQuarantine;
end.

#

@hearty horizon thats is a sctipt..

hearty horizon
#

haha lmao

#

nice script

lilac jungle
#

Hi, do you have any docs for server webhook?

#

Or what types of requests can the webhook send?

#

I have already setup "upvote"

turbid shale
#

@waxen siren

waxen siren
#

@turbid shale

half orbit
waxen siren
#

full code

half orbit
#

i dont have a error

molten yarrow
half orbit
#

which intent ?

molten yarrow
#

no its GUILD_MEMBERS for guildMemberAdd and guildMemberRemove events

#

also need to enable it in your dev portal

half orbit
#

ok thx

tired panther
#

from the shard manager(auto), should it be client.shard.totalShards.count ?

half orbit
slender thistle
lilac jungle
slender thistle
lilac jungle
slender thistle
#

Server webhook is basically the same thing as bot webhooks

#

POST request sent on each vote/test to specified URL with specified Authorization header

earnest phoenix
#

Javascript weird

quartz kindle
#

client.shard is not the sharding manager

#

they are two different structures

tired panther
#

I am using the auto shard manager form discrd js

quartz kindle
tired panther
#

yes, but how can i pass the value form the shard manager?

quartz kindle
#

what value

tired panther
#

the shard count

quartz kindle
#

from client.shard

tired panther
#

I just wanna know the number of exiting shards

quartz kindle
#

did you look at the links above?

#

theres your answer lol

tired panther
#

client.shard.count?

tired panther
#

or can I user broadcasteval("process.exit();")

#

to kill all shards?

quartz kindle
tired panther
#

I programmed , so long on my bot, but did not ever edit a embed message!

#

how does it works?

quartz kindle
#

message.edit?

rocky hearth
#

How can I know, who has invited the member to the server?

#

Or can I get the link through which the member has joined the server?

quartz kindle
#

nope

#

the only way to do that is to keep track of invite uses

#

you need to fetch all invites when your bot starts, then when a user joins you need to fetch the invites again, and compare which invite got its usage count increased

tired panther
#
 let msg = await message.channel.send({embed: helpmessage}).then(suggestmessage => {
                suggestmessage.react("πŸ‘");});
                const filter = (reaction) => reaction.emoji.name === 'πŸ‘';
        const collector = msg.createReactionCollector(filter, { time: 15000});
        collector.on('collect', r => msg.edit(testmessage));
        collector.on('end', collected => console.log(`Collected ${collected.size} items`));
``` it does not edit the message, without reaction it works, with ==> no
quartz kindle
#

@tired panther you're overriding the return value of the promise

rocky hearth
#

Ooh wow! Nice trick...
Is there any chance the usage count could get decreased?

quartz kindle
#

not that i know of

tired panther
#

where did i overwrite it?

quartz kindle
#

@tired panther ```js
let a = await x.send() // a is the sent message
let a = await x.send().then(b) // a is the result of b

#

the await returns the final value of the promise chain, including all the .thens you use

#

in your case, your .then() is not returning anything, so msg becomes undefined

tired panther
#
let msg = await message.channel.send({embed: helpmessage})
                msg.react("πŸ‘");
                const filter = (reaction) => reaction.emoji.name === 'πŸ‘';
        const collector = msg.createReactionCollector(filter, { time: 15000});
        collector.on('collect', r => msg.edit(testmessage));
        collector.on('end', collected => console.log(`Collected ${collected.size} items`));
``` will that work?
quartz kindle
#

await msg.react()

tired panther
#

thx, it works

rocky hearth
#

@tired panther If your helpmessage is an embed. You can directly pass it to send. No need to create an extra object

tired panther
#

@quartz kindle how can i built in a if case in collector.on

unborn ridge
#

I need a help

#

Can I set per server prefix using quick.db

rocky hearth
#

not just quick.db though

earnest phoenix
#

is the on_ready event changed in the discord.py? It's not working anymore, came after 4 months πŸ˜„

cinder patio
#

how exactly is it not working?

unborn ridge
#

I have done it

#

@rocky hearth

rocky hearth
#

congo πŸ₯³

unborn ridge
#

Thank u

#

But the thing is I have to change p! To {prefix} in all the command where I used p!

earnest phoenix
#

how to get system spec ?

#

in js

unborn ridge
#

I am running my tiny brain to think that like I have default messsage in app.js but I am able to set welcome channel can I set welcome message too

unborn ridge
#

Dm aajao

#

Btata

earnest phoenix
#

ok

#

@unborn ridge dm

unborn ridge
#

Yes

#

Will it change in full bot

#

Or in one file only

outer perch
#

one only

#

u gotta go to every file

#

and do it

#

or else only one changes

crimson vapor
#

make sure prefix is defined wherever you use it or it will error

unborn ridge
#

yes

rocky hearth
#

what is the systemChannel for the server?

near stratus
#

Default is the #General
but I think it's deprecated

rocky hearth
#

no it's not mentioned in the docs

near stratus
#

Then it's good to go

#

Before we weren't able to edit or delete that channel but then there was a change and as you can see we can delete or Edit the channel and actually set a different channel for System message.

earnest phoenix
#

ping

#

Pong!

earnest phoenix
near stratus
#

Anyway,
How do I get id of an Emoji ?

earnest phoenix
slender thistle
#

Default channels don't exist anymore

near stratus
slender thistle
#

A guild is able to contain no channels

near stratus
#

We weren't able to delete #gen then

earnest phoenix
#

escape the emoji

delicate zephyr
#

#general has the id 264445053596991498 which is the same as the guild

earnest phoenix
#

@near stratus there is a GuildEmoji class which extends the Emoji class

near stratus
#

like
\:emoji_name:
It don't work

earnest phoenix
#

hm

#

are you talking about escaping emotes to use them in bots or do you want the actual id for some other shit

earnest phoenix
#

search docs

#

jk

near stratus
#

:pogey:

#

:pogey

#

Nah it doesn't work for me

earnest phoenix
near stratus
earnest phoenix
#

oh mobile

#

you can't escape emojis on mobile

#

there you go

near stratus
#

I can only escape Mention and Channels in Mobile

earnest phoenix
#

now just copy paste the whole thing (not just the id) then use it anywhere in your bot

#

you can

near stratus
#

@earnest phoenix

earnest phoenix
#

normal users can use it too

#

just surround it with `

mild flower
#

:verified: this is not working

earnest phoenix
#

but bots can't use custom emojis without that

#

also bots don't need to pay for nitro

near stratus
#

\:pogey:

earnest phoenix
#

without \

#

:pogey:

near stratus
#

![pogey](https://cdn.discordapp.com/emojis/622738892856229898.webp?size=128 "pogey")

earnest phoenix
#

:pogey:

#

doesn't work on pc

near stratus
#

It hell works

#

on mobile

earnest phoenix
#

awesome

#

Right, they have their own way lul

near stratus
#

I thought for half an hour on this

earnest phoenix
#

now you know smirk

#

awesome

#

does the npm package chalk have a client-side version i can use in browser javascript?

#

or do the color stuff only work in terminals

mild flower
#

its supposed to show this : pinkcheck

earnest phoenix
#

i-

near stratus
feral aspen
#
    const user = message.mentions.users.first()

    const embed = new Discord.MessageEmbed()
    .setColor(colors.cyan)
    .setImage(user.user.displayAvatarURL())

    message.channel.send(displayAvatarURL)
#

It says displayAvatarURL is undefined or something

#

I don't want to look stupid! 😐

sudden geyser
earnest phoenix
earnest phoenix
sudden geyser
earnest phoenix
#

that's not a GuildMember my boy

feral aspen
#
ReferenceError: displayAvatarURL is not defined
#

Still errors.

near stratus
#

use user.displayAvatarURL({format:"jpg"})

#

don't use user twice

feral aspen
#

I didnt use it twice

earnest phoenix
#

then there is no user mentioned (so user is null)

#

send your code

near stratus
#

and use

message.channel.send(embed)
feral aspen
#
const user = message.mentions.users.first()

    const embed = new Discord.MessageEmbed()
    .setColor(colors.cyan)
    .setImage(user.displayAvatarURL({format:"jpg"}))

    message.channel.send(displayAvatarURL)```
#

OH SHOOT

#

πŸ€¦β€β™‚οΈ πŸ€¦β€β™‚οΈ πŸ€¦β€β™‚οΈ πŸ€¦β€β™‚οΈ πŸ€¦β€β™‚οΈ

#

omg.

#

I should have had hot chocolate this morning.

near stratus
#
const user = message.mentions.users.first()
    const embed = new Discord.MessageEmbed()
    .setColor(colors.cyan)
    .setImage(user.displayAvatarURL({format:"jpg"}))
    message.channel.send(embed)
#

lol

feral aspen
#

Yes, thank you.

#

Omg

earnest phoenix
#

I need help with mimu-

feral aspen
#

I was so stupid, Sorry I am tired.

near stratus
earnest phoenix
#

I

near stratus
#

huh ?

feral aspen
#

Oii

earnest phoenix
#

I dont think i got the right server-

feral aspen
#

Can't I make it like the picture to be full screen? Like high quality

near stratus
feral aspen
earnest phoenix
earnest phoenix
feral aspen
#

Can't I make it like the picture to be full screen? Like high quality

#

It's like small! 😐

#

I want it big. Any way?

earnest phoenix
#

you only get upto 4028 pixels

near stratus
earnest phoenix
#

*4096

#

which is already pretty high quality

near stratus
#

https://cdn.discordapp.com/avatars/584309117380853770/44288597befe003628809bca1005fb47.png? This is my avatar

feral aspen
#

No, when I send the message, it's small picture.

#

I want it big

near stratus
#

Just add size attribute after that

earnest phoenix
#

because you don't specify the size in the function

near stratus
#

like:::

https://cdn.discordapp.com/avatars/584309117380853770/44288597befe003628809bca1005fb47.png?size=256
earnest phoenix
#
user.displayAvatarURL({ /* settings */ });
near stratus
#

You can define size in that object

earnest phoenix
near stratus
#
const user = message.mentions.users.first()
    const embed = new Discord.MessageEmbed()
    .setColor(colors.cyan)
    .setImage(user.displayAvatarURL({format:"jpg",size:"your-desired-size"}))
    message.channel.send(embed)
feral aspen
#

done

#

size: 2048

#

πŸ™‚

#

Thanks all.

earnest phoenix
#

keep in mind high quality images take longer to load on people's computers

earnest phoenix
coral trellis
#

-wrongserver @earnest phoenix

gilded plankBOT
#

@earnest phoenix

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(

earnest phoenix
#

I-

near stratus
safe creek
earnest phoenix
#

quote button no exist so I'm replying with blank message

feral aspen
#

πŸ˜›

near stratus
earnest phoenix
#

4096x4096 == 16777216

feral aspen
#

🀯

earnest phoenix
#

that much pixels in a single avatar

feral aspen
#

😐

earnest phoenix
#

each pixel is about one byte in PNG iirc

feral aspen
#

Yeah

near stratus
earnest phoenix
#

16384KB size

near stratus
#

16 MB

earnest phoenix
#

exactly 16 MB size

#

that much for a single avatar

near stratus
#

I'll be happy with 256

earnest phoenix
#

we haven't even started with dynamic avatars

near stratus
#

Just don't set dynamic = true and size = 4096 together everrr

earnest phoenix
#

https://cdn.discordapp.com/avatars/503948134439976972/a_11c5790bc7a40220e03356e1a59dae8f.gif?size=4096

#

wait GIF images are WAY more compression-y than PNG

#

so umm

#

bro my avatar in PNG format is 3 KB and 3 MB in GIF

#

we suck at meth

#

@near stratus

sudden geyser
near stratus
earnest phoenix
mild flower
earnest phoenix
earnest phoenix
#

(node:19884) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.description: Must be 2048 or fewer in length.

#

how i can cut the text 😐

tulip ledge
#

just type less text

earnest phoenix
tulip ledge
#

or split the text into pieces at every x length and put them in array and use reactions/message collectors to turn pages

earnest phoenix
#

but

#

or send it in two messages

#

i am trying to do a lyrics command

quartz hill
#

I want to create a profile card. But sources I have found are not very good. I wonder if anyone knows a good resource? With descriptive codes. (with discordjs)

earnest phoenix
#

so i cant edit the lyrics

earnest phoenix
earnest phoenix
#

split the text into multiple parts of 2048 characters each

earnest phoenix
#

learn pagination systems

#

oh ok

#

can someone explain me why app.listen in express makes repl log the whole server instance in the console

tulip ledge
#

I'm not the best at ejs express sorry bud can't help u

earnest phoenix
#

ejs?

#

I'm using node.js

tulip ledge
#

yeh ur express right

#

ejs and express

earnest phoenix
#

not the <% %> stuff

tulip ledge
#

oh

#

Oh I see now

#

ok nvm

earnest phoenix
tulip ledge
#

Bruh I'm LoL I said jungle first now this kid started jungling and is taking all my camps ;-;

earnest phoenix
#

@pale vessel well can ye help me at least

pale vessel
#

uwotm8

stoic girder
#

Perhaps there's some logging setting, I'm not sure.

#

Switched to a proper hosting recently lol

earnest phoenix
#

ig the console is express's default debugger

#

at least on repl

tulip ledge
#

question

#

to make a dashboard

#

do I need ejs too? or just express

earnest phoenix
#

egirls and now ejs

tulip ledge
#

like

#

I already have a website made in html/css/js

#

but I also want to add a dashboard

#

so do I need ejs? or just express

stoic girder
earnest phoenix
#

how to make a eval command ?

tulip ledge
#

oh god no

#

who uses php these days when u have JS

stoic girder
#

people hate php but i think i'll take that approach for my own dashboard, instead of learning shitton of js stuff lol

tulip ledge
#

I just wanna know if I need ejs too ;-;

stoic girder
#

ejs is a frontend framework, right?

tulip ledge
#

its used to put vaiables and js functions into html basically

pale vessel
#

Use ejs if you're not a masochist

stoic girder
#

i guess you can use something like vue

#

or angular?

#

if you dont want ejs

pale vessel
#

yeah or react

stoic girder
#

not too familiar with that stuff but i like vue

pale vessel
#

react is hard though

#

for me

tulip ledge
#

wich is the best ioption?

#

I know a bit of ejs

pale vessel
#

Ejs for starters

#

use views

earnest phoenix
#

how to make eval commanddddddddd

stoic girder
#

you can try some basic code in few of them and see which one you like

#

@earnest phoenix which language

earnest phoenix
#

js

#

discord.js

stoic girder
#

just make sure others cant abuse it

#

coz it can be real real dangerous

#

quoting the site

#

I AM NOT RESPONSIBLE IF YOU FUCK UP, AND NEITHER ARE ANY OF THE DISCORD.JS USERS AND DEVELOPERS

earnest phoenix
#

if i upgrade my mongodb subscription from free to paid, will it reset my database collections? i am just confirming once

cinder patio
#

most likely no

hollow sedge
#

it's definitely not going to clear your data without clearly saying so

drifting wedge
#
    embed=discord.Embed(description=f"![tick](https://cdn.discordapp.com/emojis/764127754861412362.webp?size=128 "tick") Please use: `s, m, h, d or w!`", color=0xEF476F)
NameError: name 'discord' is not defined``` whyyy
sudden geyser
#

did you import it

drifting wedge
#

ye

#

it works normally\

#

wait 1 sec

safe creek
#

if i want to make an economy category etc will i need an data base?

drifting wedge
#

ye

#

dpy?

safe creek
#

is there one i can use thats somewhat free?

drifting wedge
#

self host or interwebz host?

safe creek
#

or that you recommend

#

hmmmm

drifting wedge
#

also what host do u use for ur bot?

safe creek
#

i seee

#

i dont use one atm

drifting wedge
#

how does your bot run?

safe creek
#

Visual Studio Code

#

atm

#

as im still making it

wary wedge
#

im intrested how would i go about making a bot?

safe creek
#

botZ?

#

@drifting wedge

drifting wedge
#

HOW DO U RUN IT

wary wedge
#

i miss clicked

drifting wedge
#

@safe creek

#

idgaf about how u make it

#

how do u code it

#

run it*

safe creek
#

it runs in vsc atm i havent got a hosting service ffs

wary wedge
#

ok so what programs would i need to make a bot?

safe creek
#

vsc

#

or look on yt @wary wedge

drifting wedge
#

there r free metgods for both

safe creek
#

which would be better

drifting wedge
#

mongodb

safe creek
#

mmk

drifting wedge
#

you can host on heroku

#

which is free

#

and u can use online db

#

and ur good

#

heroku cant work with local dbs

safe creek
#

oh ok

#

i see

#

thanks

fringe ivy
#

Aku ok doh

unborn ridge
#
  let chx = db.get(`welchannel_${member.guild.id}`);
  let msx = db.get(`welmessage_${member.guild.id}`)
  .replace(/`?\?member`?/g, member) // Member mention substitution
  .replace(/`?\?username`?/g, member.user.username) // Username substitution
  .replace(/`?\?tag`?/g, member.user.tag) // Tag substitution
  .replace(/`?\?size`?/g, member.guild.members.cache.size); // Guild size substitution
  if (chx === null) {
    return;
  }

  
   let data = await canva.welcome(member, { link: "https://i.pinimg.com/originals/f3/1c/39/f31c39d56512dc8fbf30f9d0fb3ee9d3.jpg" })
 
    const attachment = new discord.MessageAttachment(
      data,
      "welcome-image.png"
    );
  
  


  bot.channels.cache.get(chx).send((msx), attachment);
});```
#

(node:10928) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of null

earnest phoenix
#

i need someone to please help remake my discord bot because me and my friend got into an arguement and he deleted it...

#

he gave me a backup though

fringe ivy
#

Apa tuuuuuuuuuuuu

safe creek
earnest phoenix
#

i cant...

safe creek
#

f

earnest phoenix
#

i dont own a PC & idk how to code...

#

but i have a panel but it has 64 MB only

safe creek
#

well gl

earnest phoenix
#

i am asking for help.

#

All Is Well bolo

outer perch
eternal osprey
#

(node:8644) UnhandledPromiseRejectionWarning: ReferenceError: raid is not defined

let res = await afetch("https://nycpokemap.com/raids.php?time=" + new Date().valueOf())
     let data = await res.json();
     const getName = id => nameList.filter(el => el.i === id)[0].n;
     console.log(raid.pokemon_id + options.name)
     let raids = data.raids.filter(raid => getName(raid.pokemon_id).toLowerCase() === options.name.toLowerCase() && raid.level >= (options.level ? options.level : 5))```
outer perch
#

and this welmessage_$

eternal osprey
#

could somebody help me with my problem?

outer perch
#

console.log(raid.pokemon_id + options.name)

#

put it at the end of that code

#

not in the middle

#

@eternal osprey u can't log something that's only defined later

earnest phoenix
#

that's true

eternal osprey
#

i know

#

but it would still send the same error message

earnest phoenix
#

m

eternal osprey
#

(node:11476) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined

outer perch
#

nono

#

sorry forget that

eternal osprey
#

i have changed everything but it still sends an error

outer perch
#

try raids inside the log instead of just raid

hard anchor
#

Hello everyone, someone pass me code for my bot to send memes to discord.py, I am using imgBB as image host

eternal osprey
#

@hard anchor lmao code yourself

earnest phoenix
#

lmao

outer perch
#

xD

eternal osprey
#

@outer perch yeah but it is from a website

outer perch
#

oh

hard anchor
#

I am very new to python haha

outer perch
#

so take a better look

earnest phoenix
#

discord.js has more support for coding bots
(i believe)

eternal osprey
#

hmm i have no clue what is wrong with my code.

#

i have been at this for atleast 3 days

#

could somebody have a look please?

unborn ridge
#

i have to send welocome message

#

setted with quick.db

outer perch
#

but not in there

unborn ridge
#

then where'

outer perch
unborn ridge
#

what should i doo

#

wait see

#

i want that like

#

if user set welcome message

#

welcome ?member

#

?member should be replace to ${member.username}

#

or anything

#

@outer perch

outer perch
#

no

cerulean pebble
#

help me

#

how to open it

outer perch
#

ask another person now I cant really help

#

click Read more here @cerulean pebble

cerulean pebble
#

On October 7, 2020 the events under the GUILD_PRESENCES and GUILD_MEMBERS intents will be turned off by default on all gateway versions. If you are using Gateway v6, you will receive those events if you have enabled the flags for those intents in the Developer Portal and have been verified if your bot is in 100 or more guilds. You do not need to use Intents on Gateway v6 to receive these events; you just need to enable the flags.
If you are using Gateway v8, Intents are mandatory and must be specified when connecting

tulip ledge
#
          let members = []          
          for(i = 0; i < guildMembers.length; i++) {
            members.push(guildMembers[i]["uuid"])
          }
          console.log(members)

I am SO confused ;-;
cannot read property members of undefined

#

like what is that error ;-;

#

I'm using members as a variable not a property ;-;

cerulean pebble
#

help me

#

they banned the open

cold vessel
#

you're probably in 100 guilds so you have to be verified

cerulean pebble
#

After our deprecation period ends, if your bot is in over 100 servers, you cannot turn on Privileged Intents until you get whitelisted first. We don't want you to have broken bots, so please get whitelisted first. :))

#

@cold vessel you can see :))

cold vessel
#

Yeah, you need to verify your bot on the developer page there should be a prompt at the top of the page

cerulean pebble
#

where ?

#

i can not see

cold vessel
#

at the top of your bot page there should be something that says verify or whitelist or something

cerulean pebble
cold vessel
#

Can you send a picture of the page (don't leak anything)

cerulean pebble
#

nothing to leak

cold vessel
#

Hmm. Did you get a system message from discord?

cerulean pebble
#

wait

cold vessel
cerulean pebble
#

yes it was 4 months ago

cold vessel
#

I don't know what to tell you other than you have to verify

leaden rover
#

I need to make a modrole command, but how do I use for role in ctx.author.roles: with the modroles.json file I have?

indigo flax
#

what is the eval to send a message in a certain channelID using python

#

ik its ctx.send

drifting wedge
#

can i like listen to voice chats in discordpy?

#

ping plezzz

indigo flax
#

@drifting wedge

drifting wedge
#

with responses

cerulean pebble
#

(node:9968) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'count' of undefined
at Object.exports.run (C:\Users\Win10\Desktop\bot3 - Copy\commands\votekick.js:28:41)

#

var NO_Count = reactions.get(disagree).count;

#

????

#
const reactions = await VOTE_TEXT.awaitReactions(reaction => reaction.emoji.name === agree || reaction.emoji.name === disagree, {time: 60000});
  VOTE_TEXT.delete();

  var NO_Count = reactions.get(disagree).count;
  var YES_Count = reactions.get(agree);

  if(YES_Count == undefined){
    var YES_Count = 1;
  }else{
    var YES_Count = reactions.get(agree).count;
  }
shy fractal
#

what prem should server and user info requre?

pale vessel
#

YES

solemn latch
#

none?

pale vessel
#

My friend uses administrator lol

#

(for the executor)

shy fractal
#
  1. Your bot must keep all owner commands locked to developers (e.g evals, status/presence commands and any other commands that may present vulnerabilities with your bot)
    whats ment with presence commands?
cerulean pebble
#

help me :))

earnest phoenix
indigo flax
#

i figured out how to do it

earnest phoenix
quick ridge
sudden geyser
#

You probably don't have git installed

quick ridge
#

how will I do

#

This is the first time I have called such an error

sudden geyser
#

well try running git --version in the command prompt

#

You'll either get the current version of git, or an error.

quick ridge
sudden geyser
#

So you either don't have it installed or added to your system path environment variable

quick ridge
#

i will try thx

drifting wedge
cerulean pebble
#

hello me

quick ridge
#

yep its fixed thx @sudden geyser

earnest phoenix
#

Halo

sudden geyser
#

Git is very useful. You should try using it

earnest phoenix
#

Hell yeah git is great

agile lance
#

How can I compare 2 users roles?

Code I tried:
let m = message.guild.members.cache.get(args[1])
if(m.member.highestRole.position > message.author.highestRole.position) return;

sudden geyser
drifting wedge
#

aww man

boreal iron
#

why doing what Discord already does?

sudden geyser
#

Yeah, you can't get yourself on a list pandasad

boreal iron
#

ask to get a copy of the meeting from Discord or the NSA

drifting wedge
#

how does mee6 do it?

#

@sudden geyser ping

sudden geyser
#

idk

#

If Discord can do it, you possibly could too. But it's out of my reach.

quick ridge
#

how can i change my rgb codes to hex

#

its print like this

earnest phoenix
#

is it that hard to take 10 seconds out of your day to do a google search

#

the solution there is manual conversion there are better ways programmatically

quick ridge
#

I've tried all the functions but the calculation either gives an incorrect value or gives an error

pure lion
#

I am very confused

hollow sedge
quick ridge
#
 const ColorThief = require('colorthief');
  let renkcik2 = ColorThief.getColor(url) 
  .then(asΔ±l => { console.log(asΔ±l) })
  .catch(err => { console.log(err) })

  function componentToHex(renkcik2) {
    let hex = renkcik2.toString(16);
    return hex.length == 1 ? "0" + hex : hex;
  }
  function rgbToHex(r, g, b) {
    return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
  }
  console.log(rgbToHex(renkcik2));```
#

like that ?

hollow sedge
#

Why don't you just see if it works?

quick ridge
#

i got error

umbral zealot
#

getColor returns a promise, you have to resolve it

reef carbon
#

what's the mysql equivalent of asyncpg?

quick ridge
#

I do not know how to do it :/

umbral zealot
old cliff
#

Badge is not an array nor an object

#

So it doesn't have a join method

quick ridge
#
const ColorThief = require('colorthief');
  let renkcik2 = ColorThief.getColor(url) 
  .then(asΔ±l => { console.log(asΔ±l) })
  .catch(err => { console.log(err) })

  var rgbToHex = function (renkcik2) { 
    var hex = Number(renkcik2).toString(16);
    if (hex.length < 2) {
         hex = "0" + hex;
    }
    return hex;
  };

  var fullColorHex = function(r,g,b) {   
    var red = rgbToHex(r);
    var green = rgbToHex(g);
    var blue = rgbToHex(b);
    return red+green+blue;
  };
  console.log(fullColorHex(renkcik2))```
#

i do it this

#

but its sending NaNNaNNaN

solemn latch
#

your fullColorHex expects three numbers, but you are providing one string(or whatever ColorThief.getColor(url) returns)

lament rock
solemn latch
#

arrays are not a number

umbral zealot
#

Go learn how promises work and resolve it.

agile lance
#

Don’t be like that to him. All he wants to do is remove it from the array.

agile lance
quick ridge
#

js

quick ridge
agile lance
#

Javascript you can do something like this:

let returnedArray = Fill this with how you get the array with the 3 numbers.

console.log(returnedArray[1] + β€œ, β€œ + returnedArray[2] + β€œ, β€œ + returnedArray[3])

#

If you already have the array

#

Giving the 3 different numbers that will log it like

#

10, 50, 255 if that was the returned value

umbral zealot
agile lance
umbral zealot
#

I did, I pointed them to the correct page that helps them learn about promises and how they work.

quick ridge
umbral zealot
#

If someone can't bother reading and learning correctly, I usually don't feel the need to be particularly polite.

agile lance
#

@quick ridge Try my idea above

quick ridge
agile lance
#

Hm

prisma locust
#

hi I know how to code a word in a line in a message. please help by tagging.

solemn latch
#

a word?

solemn latch
#

as in a string?

agile lance
#

Variable or a string?

prisma locust
#

yes

agile lance
#

messages automatically return a string value.

pure lion
#

can anyone help me with the g-i-s module, i have this code but it always returns an empty array

#
    async execute(client, msg, args) {
        const query = args.slice(1);
        search(query, logRes);
        function logRes(err, res) {
            if (err) return msg.channel.send({embed: {
                title: "Oh mateyyyy",
                description: "An' err 'as occured when gettin' th image",                
                color: "#FB524F",
                footer: {text: msg.author.tag, icon_url: msg.author.displayAvatarURL()},
                timestamp: msg.createdTimestamp
            }});
            else
                console.log(JSON.stringify(res, null, "  "));
        }
    }```
honest perch
#

@quartz kindle so im using svelte

#

and

#

name would be the name

#

and idk how to import from a folder with the file name of name

proper bolt
#

import x from 'folder/file'

earnest phoenix
#

I ran this code and it didnt work or print anythng

@client.command()
@has_permissions(manage_nicknames=True)
async def namelock(ctx, member:discord.Member= None, *, nickname):
  if member == None:
    await ctx.send("Who do you want to namelock?")
  else:
    bruhruhru = await ctx.guild.get_role(779063756243992606)
    await member.add_roles(bruhruhru)
    await member.edit(nick=nickname)
    await ctx.send(f"{member.mention} has been namelocked to {nickname}.")
slender thistle
#

Are you sure the command actually exists?

earnest phoenix
#

wdym?

slender thistle
#

Is it actually attached to the bot in the first place?

earnest phoenix
#

yeah it is

#

like even just doing )namelock doesnt say "Who do you want to namelock?"

#

but its definitely in there as any command not in says "Command not found."

#

nibba

#

what? i already read them

#

uh i did

#

Ok i have made some edits and this is the new code:

@client.command()
@has_permissions(manage_nicknames=True)
async def namelock(ctx, member:discord.Member= None, *, nickname=None):
  if member == None:
    await ctx.send("Who do you want to namelock?")
  else:
    if nickname== None:
      await ctx.send("What is the nickname you want to set the user to?")
    else:
      io = await ctx.guild.get_role(779063756243992606)
      await member.add_roles(io)
      await member.edit(nick=nickname)
      await ctx.send(f"{member.mention} has been namelocked to {nickname}.")

if i leave any of the fields blank, it works but if i dont it doesnt

agile shuttle
#

im happy

#

becouse i finnaly put my bot 24/7

autumn compass
#

Good for you

tulip ledge
#

alright so I'm tryna do something and I can't do it so heres the problem:
every couple seconds I'm adding 1 to a variable that starts at 0, now this is used to switch through indexes in an array basically every time it hits 80 it has to go to the next index, what I tried was Math.floor(i % 80) but this didn't work, does anyone know how to do this?

sudden geyser
#

Math.floor() (Math.random()) generates a decimal between 0 and 1. If you want it to be between 0 and some number, you need to multiply the result, then you can use the modulo operator (%) as you have.

tulip ledge
#

wait what

sudden geyser
#

oh said I'm dumb

#

I didn't see the i

outer perch
#

is there another way to multiply a variable by 2 besides foo = foo * 2?

tulip ledge
#

foo *= 2

outer perch
#

ty

slender thistle
#

floor? Wouldn't it be the random method?

tulip ledge
#

????

slender thistle
#

😁

tulip ledge
#

shivaco sometimes u confuse me

#

i'm chickendev btw

slender thistle
#

See Lite's updated message

tulip ledge
#

no I dont want it like that

#

So basically what I want to do is this:
<80 -> index is 0

80 && < 160 -> index is 1
etc...

sudden geyser
#

So, let me get this straight. When i reaches 80, you want to go to the next element in the array by index. So, if I started at index 0 with no time, it was 80 seconds (for example), it would switch to index 1, correct?

#

okay so it is like that

tulip ledge
#

and after another 80 seconds it swaps to index 2

sudden geyser
#

Based off that, i / 80 and Math.floor could do you fine (Math.floor(i / 80)). If i was 150, for example, the expression would equal 1, but if it was 160, it would be 2.

tulip ledge
#

it's basically I need to make 250 api requests, now the limit is 120 so I have an array with 3 keys and I swap between them when they reach 80

earnest phoenix
#

...so use setTimeout and just increment your variable

tulip ledge
#

;-;

#

thats not-

#

what I meant

#

it's not exactly 80 seconds

#

and it's dependend on the api

earnest phoenix
#

are you trying to make a ratelimit handler

tulip ledge
#

Sort of

#

Not for my own API

#

But I need to make more requests then allowed per key

#

So I'm using it like this

earnest phoenix
#

does the API return ratelimit headers or ratelimit information in the body

tulip ledge
#

no, not that I know of

earnest phoenix
#

thonk

#

really shitty api

tulip ledge
#

what I'm doing rn is every time I make a request I just add 1 to a variable

#

When it reaches 80 I switch to the next key in the array

earnest phoenix
#

that won't be accurate though

sudden geyser
#

do you mind sharing the name of the API

tulip ledge
#

At first I was doin this: this.apiCalls > 80 ? 1 : 0 since i only needed about 125 requests, but that doubled

earnest phoenix
#

you aren't making requests at a consistent rate

tulip ledge
sudden geyser
#

Hypixel does return the ratelimit.

earnest phoenix
#

it returns ratelimit info

sudden geyser
#

Let me find my forum post about it

tulip ledge
#

wait thats the wrong one

#

oops

#

it does?

misty sigil
#

does message.member.voice.channel require intents?

misty sigil
#

im just wondering because its returning null for me

tulip ledge
#

how do I check what ratelimit is left?

sudden geyser
#

Check the returned header in the response object

#

Aka RateLimit-Remaining

tulip ledge
#

it doesnt show?

#

this is the response

sudden geyser
#

The headers.

#

Not the body.

tulip ledge
#

;-;

#

what do I do?

#

I'm confused

sudden geyser
#

What HTTP library are you using?

tulip ledge
#

node-fetch

sudden geyser
#

Then do: js fetch(...) // ... is the URL .then((res) => { res.headers.get("...") // ... should be the name of the header, like RateLimit-Remaining });

tulip ledge
#

TypeError: Cannot read property 'get' of undefined

#

But I think I know a diff solution

#

ok nvm I dont

boreal iron
#

Well obviously headers is undefined
Log your var res to see it’s properties

tulip ledge
#

nvm fixed it

#
      fetch(`https://api.hypixel.net/findGuild?key=${this.apiKeys[this.currentIndex]}&byUuid=${data["id"]}`)
      .then(response => {
        console.log(response)
        if(response.headers.get("RateLimit-Remaining") <= 20) this.currentIndex++;
        response.json()
      })
      .then(data => {
        console.log(data)

For some reason data is undefined now ;-;

quartz kindle
#

you didnt return it

tulip ledge
#

oh I forgot

#

with {} I now need to return

earnest phoenix
#

lobo

eternal osprey
#

i have been at this for atleast 3 days
https://hatebin.com/knkauwpabw

look at the code, line 52. TypeError: Cannot read property 'toLowerCase' of undefined

#

please anyone, help me out. I am literally desperate at this point.

sudden geyser
#

@eternal osprey, either the call to getName() is returning undefined, or options.name is undefined. You should try logging the value of both expressions to see which one is causing the error.

eternal osprey
#

getname is undefined

#

i tried loggin both

#

wait i can show you

#

console.log(raid.pokemon_id + options.name) this is what i am logging

#

it returns:

#

well basiocally, just the error i sent.

sudden geyser
#

Okay, now that we know that, we can see the definition of getName: js const getName = id => nameList.filter(el => el.i === id)[0].n;
The next step would be to log every element in the .filter call (console.log(el)). based on the error, there are some elements passing the filter, but you grab the first one and n as a property is returning undefined.

heavy marsh
#

in .js v12
Is this wrong to get the voice connections the bot is connected to on a shard

await client.shard.fetchClientValues('guilds.cache.filter(g => g.me.voice.channel).size');
eternal osprey
#

hmm okay @sudden geyser

#

el is not defined

#
      console.log(el)```
sudden geyser
#

You're supposed to log it in the filter as I said.

heavy marsh
#
const getName = id => nameList.filter(el => el.i === id)[0].n;
      console.log(getName)
eternal osprey
#

i've passed the el in the filter and logged it

#

it is not defined

sudden geyser
#

You're not supposed to log the function. You're supposed to log the element currently being filtered. So, in the arrow function, add a block around it so you can log it.

To put that in code: ```js
.filter((el) => {
console.log(el);

return ...
})```

earnest phoenix
#
        {
            "$match": {
            "finished": false
            }

        },
        {
            "$group": {
                "_id": null,
                "total": { "$sum": "$price" }
            }
        }
    ], function(err, result){

        console.log(result);

    })```
hello, is there a way to print the "total" or the whole result in an embed? using mongoose / javascript
quartz kindle
#

the result returned in a callback cannot be accessed from outside

#

unless you promisify it

earnest phoenix
#

any steps / idea on how to do that?

heavy marsh
eternal osprey
#

yeah i still could not fix nor log any of the info.

hasty lotus
#

hey, using js, i've got an array, and i would like to push something in it, and put it in first position.
By example :

let array = [1]
array.push(2)
console.log(array)```Will log [1,2], and i would like to do this :
```js
let array = [1]
array.pushfirstPosition(2)
console.log(array)```And ouput [2,1]. Doest anyone know how i can do that ? And am i clear in what i say ? xD
ember lodge
#
root@nodejs-s-1vcpu-1gb-tor1-01:/botdash# npm start

> botmasdashboard@0.0.1 start /botdash
> node --experimental-modules --experimental-json-modules server.js

(node:39803) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error: ENOENT: no such file or directory, scandir '/app/eventos'
    at Object.readdirSync (fs.js:1021:3)
    at registerEvents (file:///botdash/utils/registry.js:47:18)
    at file:///botdash/server.js:352:9
    at file:///botdash/server.js:356:3
    at ModuleJob.run (internal/modules/esm/module_job.js:146:23)
    at async Loader.import (internal/modules/esm/loader.js:165:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/app/eventos'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! botmasdashboard@0.0.1 start: `node --experimental-modules --experimental-json-modules server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the botmasdashboard@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-11-19T22_24_25_604Z-debug.log
root@nodejs-s-1vcpu-1gb-tor1-01:/botdash#   

Someone knows why this error happends to me when i try to start my bot in a Ubuntu VPS?

hasty lotus
#

@ember lodge seems like you doesn't have any /app/eventos directory

heavy marsh
#

Try node .

#

ok nvm ^

sudden geyser
quartz kindle
#

@earnest phoenix ```js
// option 1
....aggregate(..., (err, result) => {
// do stuff with result here
message.channel.send(result)
})

// option 2
let result = await new Promise(resolve => {
....aggregate(..., (err, result) => {
resolve(result)
})
})

hasty lotus
#

if those folders are in your bot's directory, user ./app/eventos

earnest phoenix
#

thanks!

hollow sedge
#

@hasty lotus why are you trying to do that anyway

sullen pawn
#

Bro

hasty lotus
hasty lotus
#

uh

#

what

#

what is those quotations ??

ember lodge
hollow sedge
#

"I need to do that" isn't exactly a good reason

ember lodge
hasty lotus
#

@ember lodge yes this is in your bot directory

hollow sedge
#

if you explain what you're trying to do, I might be able to show you how you're supposed to do it

quartz kindle
#

@ember lodge its looking for /app/eventos, not /eventos

hasty lotus
#

putting / will make your process search at the root directory

ember lodge
#

ohhhhh

hasty lotus
#

well i've got a command

sullen pawn
#

||galactus live event scrip startup (open to activate)
Nexus war event button
Galactus
Galactus has arrived message||

hasty lotus
#

that can be used to see the deleted messages

#

that are stored in an array form

ember lodge
#

If i put my bot in root directory

#

will it be ok?

hasty lotus
#

yes

#

it should

hollow sedge
#

That's it? @hasty lotus

hasty lotus
#

no

sullen pawn
#

I did that bc I found the fortnight scrips to start the galactus live event

hasty lotus
#

i can store multiple messages

#

but when i push it

#

if i want to get the last deleted message

#

i need to get the last item of the array

hollow sedge
#

Then get the last item of the array?

hasty lotus
#

i could

#

but i've also done womething

#

in which you can see old messages

#
const msg = snipes[args[0] - 1 || 0];```
#

when snipe is the array with all the messages

#

but there

#

if you do ;snipe 1

#

it will print the first deleted message

hollow sedge
#

Ok I don't understand what you're saying lol

hasty lotus
#

ok

#

i've got this array

#

that looks like that (simplified) :

#
[
  { "content":"blablabla (msg content)" },
  { "content":"content again"}
]```
#

and every time my bot emits the messageDelete event

eternal osprey
hasty lotus
#

i push ({message.content})

quartz kindle
#

@hasty lotus use array.splice()

hasty lotus
#

into that array

hasty lotus
earnest phoenix
#

@hasty lotus use array.splice()
@quartz kindle can you guide me how to do it 1 by 1 if its okay? haha

hollow sedge
#

Ok cool, but you're not explaining why you can't just get the last item in the list

#

@hasty lotus

hasty lotus
#

well

#

il my command

#

const msg = snipes[args[0] - 1 || 0];

#

i would like

#

that when you do ;snipe 1

quartz kindle
hasty lotus
#

insthead of getting the first deleted msg

#

(the first item of the array)

#

it gets the last

#

or

#

when a message is deleted

high berry
hasty lotus
#

it is stored as the first item of the array

high berry
#

im sure there's a method to accomplish what you're asking

hollow sedge
#

yes, so you start at the end and subtract the number entered @hasty lotus

hasty lotus
#

how ?

hollow sedge
#

Subtract args[0] from the length of the array (snipes.length)

hasty lotus
#

doesn't work

#

still showing the first element of the array

#

:c

earnest phoenix
#

@earnest phoenix ```js
// option 1
....aggregate(..., (err, result) => {
// do stuff with result here
message.channel.send(result)
})

// option 2
let result = await new Promise(resolve => {
....aggregate(..., (err, result) => {
resolve(result)
})
})

#

its returning like this

hollow sedge
hasty lotus
#

yes

#

that's what i've done

#

and when you put 1

hollow sedge
#

Is the first element the same as the last element...?

hasty lotus
#

it returns the first item

hollow sedge
#

Alright well that doesn't make sense then

#

How many items are in the list @hasty lotus

#

Were*

#

Nvm

hasty lotus
#

17 i think

hollow sedge
#

They should've been different as long as there were more than 1

high berry
#

seems like a syntax issue

#

the logic makes sense

hollow sedge
#

🀷 can you show us the lines

#

@hasty lotus

#

Well that's a rip

#

I hope you don't go with the splice method

#

Which is not convention

hasty lotus
#

ok nvm sry i found a solution to put the item in first position

#

^^

hollow sedge
#

Bad idea but ok

#

It's slower than simply using indexing

ember lodge
#

@quartz kindle @hasty lotus

vernal rivet
#

app/utils/eventos? Typo?

ember lodge
#

it is a directory

vernal rivet
#

Eventos?

ember lodge
#

yeah

vernal rivet
#

Are you importing, or readdirSync?

#

If you are importing then your paths are cwd based. If you readdirSync, then your paths are root based

ember lodge
#

i am importing

#

so...?

vernal rivet
#

Are they in the cwd or root dir?

limpid shadow
#

,

hollow sedge
#

@limpid shadow did you want to say something..?