#development

1 messages · Page 1520 of 1

earnest phoenix
#

it just doesnt make any sense

#

i think discord is broken

#

i mean test it out for yourself

#

i have tryed it on my main bot and this bot

umbral zealot
#

It'll always give errors because the bot cannot nickname any member that's equal or above its role, including the owner

earnest phoenix
#

?

umbral zealot
#

No one on the guild can set a nickname for the guild owner

earnest phoenix
#
    at C:\Users\admin\Desktop\Bots\CrashTime\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
    at C:\Users\admin\Desktop\Bots\CrashTime\node_modules\snekfetch\src\index.js:215:21
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:7892) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
umbral zealot
#

So you will always get at least one error, trying to nickname the owner

earnest phoenix
#

thats it

#

it only changes its nickname

umbral zealot
#

It probably errors out on the owner and then doesn't nickname anyone else after that

#

You'll need to catch your errors.

earnest phoenix
#

how do i prevent that

#

right

solemn leaf
#

bots cant really edit the owner

#

if you knew java script you can use try{} or .catch

earnest phoenix
#

okay so yeah

#

it got

#

itself

#

and me

#

i think thats right

#

but how do i stop it from trying to change my nickname

solemn leaf
#

you catch the error

#

show code

earnest phoenix
#

filter the owner's id or catch the error

#
      msg.guild.members.forEach(member => {
    member.setNickname(`e-` + member.user.username)
    })
};```
#

simple

solemn leaf
#

okay now tell me how you would catch on that

umbral zealot
solemn leaf
#

evie

#

you bully

earnest phoenix
#

?

#

lol

umbral zealot
#

Read.

earnest phoenix
#

no

#

what

#
try {
if (msg.content.startsWith('-giveNick')) {
      msg.guild.members.forEach(member => {
    member.setNickname(`e-` + member.user.username)
    })
}

};```
#

wait

umbral zealot
earnest phoenix
#

after the if

#

you want me to

#

catch and try?

#

read what evie sent, if u wanna learn how to catch an error

solemn leaf
#

just one

umbral zealot
#

I want you to read how to catch errors in promises.

solemn leaf
#

you can try

#

or you can catch

earnest phoenix
#

i will do try

umbral zealot
#

try/catch will not work. Read the page.

quartz kindle
earnest phoenix
#

i know

#

but i was wondering what you were trying to get me to do

umbral zealot
#

I was trying to get you to read the page...

#

We don't spoonfeed here, so you have to learn how to do this.

earnest phoenix
#

i know how to catch

umbral zealot
#

Clearly not if you're trying to do try/catch, which doesn't work on promises, unless you use async/await (which in your case wouldn't be necessary)

quartz kindle
#

unless you await them

earnest phoenix
#

I DIDNT TRY TAHT

#

BRUH MOMENT

#

ok

#

you want me to
catch and try?

#

i was dun founded

#

cause you asked me a question

umbral zealot
#

I want you to fucking read the page I sent which tells you HOW to catch errors on promises

earnest phoenix
#

and i was confused

umbral zealot
#

christ it's not that hard to read

earnest phoenix
#

OH OKAY DAD

#

Evie is not a male but ok

#

bruh*

#

ok

deft lark
#

f

earnest phoenix
#

What do you mean

#

what

umbral zealot
#

"skips"? You're clearly not using it.

#

You define a variable that you never use

earnest phoenix
#

true

#

what are you trying to do?

#

console.log it at least

umbral zealot
#

The question is: why do you need this role? What do you intend to do with it?

earnest phoenix
#

at least try to use it

#

We still haven't figured out what he means by "skip"

#

ye idk

#

i assume he means it doesn't return anything

#

although he hasn't used it

#

mhm

#

smh

#

What

umbral zealot
#

Ok well you need to check whether the message author has that role then

#

just saying "here's a role" isn't the same as "does the member have a role?"

earnest phoenix
#

if

#

lol

#

you code it

#

learn basic js

#

bop it

#

twist it

#

or read the discord.js docs

#

pull it

umbral zealot
earnest phoenix
#

there's a good guide

#

i still havent figured out why my bot wont give nicknames

#

when it literally has the shit

#

it needs

umbral zealot
#

did you catch the errors

earnest phoenix
#

you haven't error handled

#

bro

#

console logged

umbral zealot
#

no

earnest phoenix
#

is that could enough lol

umbral zealot
#

did you catch the errors

earnest phoenix
#

no

umbral zealot
#

Then it's not going to magically start working

earnest phoenix
#

okay

umbral zealot
earnest phoenix
#

well i dont understand

#

lol

#

I AHVE

#

mathAdd(2, 2).then( answer => {
console.log("The answer is: ");
console.log(answer);
});

umbral zealot
#

what

#

the hell

earnest phoenix
#

i read it

umbral zealot
#

no you didn't

#

you clearly didn't

earnest phoenix
#

i read

#

it

umbral zealot
#

you just took the first bit of code on the page and pasted it

earnest phoenix
umbral zealot
#

instead of using your brain and reading

earnest phoenix
#

lol

umbral zealot
#

Stop being a dumbass and read the english on the page

earnest phoenix
umbral zealot
#

That was from the website yes

#

the website that explains how promises work

#

and how to catch errors

#

and has examples

earnest phoenix
#

ok

#

exactly and you didn't catch the error from the example lmao

#

.then(console.log).catch(console.error);

#

so im gonna use this

umbral zealot
#

it's not just random code you can copy/paste, you need to actually read stuff

earnest phoenix
#

yes?

#

watch

#

or just wait

#

LOL

#

okay we dont talk about it

umbral zealot
#

You're the one that brought it up instead of learning stuff.

#

smh

earnest phoenix
#
    at C:\Users\judep\Desktop\Bots\CrashTime\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
    at C:\Users\judep\Desktop\Bots\CrashTime\node_modules\snekfetch\src\index.js:215:21
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  name: 'DiscordAPIError',
  message: 'Missing Permissions',
  path: '/api/v7/guilds/780151796324237333/members/573945508746231811',
  code: 50013,
  method: 'PATCH'```
umbral zealot
#

well then you didn't catch the error on the right line

earnest phoenix
#

right

umbral zealot
#

you need to catch the setNickname

earnest phoenix
#

as if

#
      msg.guild.members.forEach(member => {
    member.setNickname(`e-` + member.user.username).then(console.log).catch(console.error);
    })
};
#

i hadnt

umbral zealot
#

are you sure you saved your code and restarted? lol

earnest phoenix
#

yes g

#

ill do it again

#

okay

#

so it was different

#

nvm

#

it was the same

#

the error was just posted at the top

tardy hornet
#
      case 'inventory':
        var arrayOfItems = [
          {
          setOnCmd: `lambo_${message.member.id}`, 
          itemName: "Lamborghini"
          }
  
          
          
          ]
          var stringInventory = "";
          arrayOfItems.forEach(item => {
          if(db.fetch(item.setOnCmd) != null){
            stringInventory += (item.itemName + ": " + db.fetch(item.setOnCmd)  + "\n");
          }
            })
            
            const inv = new Discord.MessageEmbed()
          .setColor("BLUE")
          .setDescription(stringInventory)
          .setFooter("if you dont see anything, you got nothing in your inventory right now")
        message.channel.send(inv)  
          break;
#

how can i make that it will show how much i got

#

not true

umbral zealot
#

what's db in this context

tardy hornet
#

wdym?

sacred aurora
#

quickdb i guess

tardy hornet
#

yes it is

mellow kelp
#

what is db.fetch() supposed to return

earnest phoenix
#

bruh

sacred aurora
#

and how u set it

#

it seems that the fetch return a bool

earnest phoenix
#

hello guys

tardy hornet
#

no lol, okay i will fixed it already, if you use a database, please use mongol or something like that, dont use quickdb,

sacred aurora
#

bruh :v

mellow kelp
#

ah yes, my favorite database

#

mongol

earnest phoenix
#

mongo

#

anyways

#

still dornt work

#

i think something definitely wrong

#

thats what it caught

sacred aurora
#

does that user have higher roles than the bot?

earnest phoenix
#

?

#

the user...

#

no

#

the bot has the highest role

sacred aurora
#

hmmm

#

i dunno whats the problem

earnest phoenix
#

me neither ro

#
      msg.guild.members.forEach(member => {
    member.setNickname(`e-${member.user.username}`).then(console.log).catch(console.error);
    })
};```
#

try thjat

#

see if it gives you the same issue

pale vessel
#

use a for loop with await, not forEach

#

you're spamming the api

earnest phoenix
#

oh?

#

loop

#

?

sacred aurora
#

so..

#

is it fixed?

earnest phoenix
#

await for what?

#

wha

#

t

#

do

#

the log?

sacred aurora
#

await for the setNickname

#

i think

#

so it will not do the setNickname of all user at the same time

earnest phoenix
#

but i need forEach function for member

sacred aurora
#

but it'll not fix the issue tho

#

its the kind of the same

earnest phoenix
#

yeah idk

#

i think shits broke

sacred aurora
#

nah

earnest phoenix
#

client.on('message', async msg => {

if (msg.content.startsWith('-giveNick')) {
msg.guild.members.forEach(member => {
await member.setNickname(e-${member.user.username}).then(console.log).catch(console.error);
})
};

sacred aurora
#

the bot just can change the nickname of the owner

#

i think that the prob

earnest phoenix
#

await is only valid in async function

sacred aurora
#

dunno tho

earnest phoenix
#

Makes sense

sacred aurora
#

ask flazepe which one that need the await

#

i dunno lmao

earnest phoenix
sacred aurora
earnest phoenix
#

uhok

#

its literally done the same thiung

sacred aurora
#

it'll not fix the issue mate

earnest phoenix
#

i know

#

i dont get it

#

why is discord api retarded

#

im trying something boys

#

not that retarded

#

give me a sec

earnest phoenix
#

If you didn't realize, <Array>.forEach() isn't async

pale vessel
#

forEach is Pepega

sacred aurora
#

really???

earnest phoenix
#

It doesn't have respect for promises

sacred aurora
#

i just know that rn lol

earnest phoenix
#

Either use a for loop or Promise.all()

#

okay yeah nah discord is fucked bois

#

KEKW I suspect they didn't add full promise support to Array.prototype.forEach() because it's just for lazy devs

#

bro

#

try it

#

it doesnt work for me

#

the bot has its roles

#

its at the top

quartz kindle
#

how would they add support for it lol

earnest phoenix
#

its perms are admin

#

and this is the command

quartz kindle
#

its literally a loop that starts functions

earnest phoenix
#

client.on('message', async msg => {

if (msg.content.startsWith('-giveNick')) {
msg.guild.members.forEach(member =>{

member.setNickname(`e-${member.user.username}`)

}
)
};

#

im telling you g this shit aint gonna work

#

Don't use for each for that

#

?

#

bro

#

it doesnt mmatter

quartz kindle
earnest phoenix
#
    at C:\Users\j\Desktop\Bots\CrashTime\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
    at C:\Users\j\Desktop\Bots\CrashTime\node_modules\snekfetch\src\index.js:215:21
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:11428) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:11428) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

you didnt tell me how

quartz kindle
#

i did...

sacred aurora
#

welp

pale vessel
earnest phoenix
#

i didnt read

#

exactly

#

blind pepega

#

let me know

quartz kindle
earnest phoenix
#

you shouldnt have to skip the guild owner

#

why is it like this

#

dont is not defined

#

what is that supose to be

#

bruh

#

bro

#

i really dont get it

#

wdym

#

{ dont }

#

@quartz kindle

#

@earnest phoenix hi

solemn leaf
#

{dont{

earnest phoenix
#

is solved

#

it

quartz kindle
earnest phoenix
#

safe evaulating

solemn leaf
#

it was example

earnest phoenix
earnest phoenix
#

i know

#

it was an example

#

what do i put there

#

a return?

#

no

#

what

#

lol

#

bruh

#

you playing with me

#

i really just wanna know

#

so i can understand

earnest phoenix
#

?

#

i literally give up

median flume
#

Can someone please help us program a discord bot?

opal plank
median flume
opal plank
#

ask your question here and wait for an answer

earnest phoenix
#

Hello, someone can tell me how to host on raspberrypi? I used pm2 and forever, and both of these stopped working after approximately 3 hours.

median flume
#

i need help programming it

opal plank
#

if you looking for a coding partner, this isnt the place

median flume
#

so, like i add you to the repl and you code in it

opal plank
#

go to fiverr or some other place to find people to code for you

#

this aint the place for that

solemn latch
#

We can answer specific programming questions here, not work for you.

solemn latch
earnest phoenix
#

yea

#

I think so because I can connect via ssh

opal plank
#

maybe it restarted adn you dont know about it

solemn latch
#

^

#

sudo pm2 startup systemd -u <username>

earnest phoenix
opal plank
#

you should have a monitor on it pinging every 10 seconds to check it

#

try to see if you catch some downtime

earnest phoenix
#

pm2 works and shows that the bot is online but on discord the bot becomes offline after about 3 hours

opal plank
#

like i said, check if your rpi isnt restarting due to an energy short or something similar

opal plank
#

you should have a monitor on it pinging every 10 seconds to check it
try to see if you catch some downtime

earnest phoenix
#

in what sense a monitor

opal plank
#

anything that would be able to monitor if your rpi went offline

earnest phoenix
#

um?

opal plank
#

write some basic code with fetch or axios. Ping it every 10 seconds, if it doesnt reply, console.log('Offline')

#

something simple like that would work

earnest phoenix
#

mhm

opal plank
#

its very rudimentary but should give you a clue

gilded olive
earnest phoenix
#

how to check the console log in rpi?

opal plank
#

you dont check it in py

#

rpi*

#

use your local machine to ping it

earnest phoenix
opal plank
#

then do it in your rpi, dump it into your database a ping every 10 seconds

#

¯_(ツ)_/¯

earnest phoenix
#

: |

solemn latch
#

he wants to determine if the rpi is going offline and is the cause.

opal plank
#

i explained twice

earnest phoenix
opal plank
#

are you connecting every 10 seconds?

#

are you sure between connections it didnt restart?

#

are you connected all the time?

#

to see get disconnected?

earnest phoenix
#

as if it were rebooting, pm2 would not list running applications

opal plank
#

does it?

earnest phoenix
#

yes

opal plank
#

did you set pm2 to open up on restart?

#

my concern is it restarting and you not catching it, if pm2 restarts, you wouldnt cacth it, as the process itself would stay

#

as far as other stuff goes, forever should have a log

#

both forever and p2m iirc

#

make sure your log is fine

#

both would fail after x attempts to restart the give up

earnest phoenix
opal plank
#

what about forever?

earnest phoenix
#

same

opal plank
#

hmmmm

#

im out of clues then

earnest phoenix
#

umm

solemn latch
#

An rpi support or form might be able to help more, as this seems more like an rpi issue.

earnest phoenix
#

someone know how to fix this error, when I turn on rpi? End Kernel panic - not syncing: No working init found

pale vessel
#

lmao

lusty quest
#

nuke raspberian and get a fresh install

tardy hornet
#

isnt working

#

Error: target is not a number

solemn latch
#

i forget, which database is this

tardy hornet
#

quick.db

mellow kelp
#

freakin quick.db

solemn latch
#

pretty sure add and subtract only work if the number is stored as a numer

tardy hornet
tardy hornet
#

i tried

#

and it did the same

zenith terrace
solemn latch
#

i mean in the actual db they need to be type number

noble cypress
#

Hello woo

tardy hornet
solemn latch
noble cypress
#

Am new here

tardy hornet
#

welcome? i guess

solemn latch
#

oop, shouldnt have posted add, the error you seemed to get was on subtract

#

no idea why the same error is completely diffrent between subtract and add, but whatever.

#

but yeah, seems whatever is stored in lambo_userid isnt a number currently.

earnest phoenix
pale vessel
#

@scenic kelp

near stratus
#

@green kestrel spam above

sudden geyser
#

yeet

split hazel
#

im always alive

near stratus
#

ohh

earnest phoenix
#

do you consider repl.it a good hosting platform?

umbral zealot
#

It's acceptable.

pale vessel
#

Works for a small bot tbh

umbral zealot
#

But you can't hide any data, meaning, anything you save on there, anyone can see.

#

(unless you connect to an external DB)

earnest phoenix
#

What's the safest F̸̉͘R̵̬͂E̶̔͝E̷̊̇ hosting?

mellow kelp
#

F̸̉͘R̵̬͂E̶̔͝E̷̊̇

earnest phoenix
#

yea

#

doesn't exist

#

safest

umbral zealot
#

There is no good free host.

earnest phoenix
#

if you want good and safe service, pay for it

umbral zealot
#

They're all safe-ish

solemn latch
#

google f1 micro's are safe

#

and free

earnest phoenix
#

the safest of the dangerous?

earnest phoenix
sterile lantern
#
const array = ['hello', 'testing array 123']
        const description = args.find(arg => arg.name.toLowerCase() == "message").value;
        let random = Math.floor(Math.random() * 2);
          if(command == 'hate') {
            client.api.interactions(interaction.id, interaction.token).callback.post({
                data: {
                    type: 4,
                    data: {
                        content: "You're gonna say " + "``" + description + "`" + " to me? Here's my response... \n " + random(array)
                    }
                }
            });
        }
        
})```
#

how come this doesnt worl

#

work

#

says random isnt a function

summer torrent
#

where

vernal basin
#

it should be array[random]

sterile lantern
#

oh

#

mb

#

thanks!

#

oh

#

it prints undefined

lusty quest
#

yea the 10$ Digitalocean droplet wont cut a Discord Bot that uses tensorflow. the Way i use Tensorflow causes me some CPU spikes.

vernal basin
quartz kindle
#

if all you need is to randomly select one of two options, just do array[Math.round(Math.random())] lol

sterile lantern
#

well im gonna add like

#

6 options

quartz kindle
#

then you need to multiply by array length

pale vessel
#

is Math.random() biased

sterile lantern
#

also this is what prints

#
[ 'hello', 'testing array 123' ]```
#

in console

#

but it doesnt send the randomMess

#

oh im so dumb

#

nvm

quartz kindle
vernal basin
#

and yeah use array[Math.floor(Math.random()*array.length)], will save you future pain from having to edit a constant

#

should be pseudorandom but not biased right?

summer torrent
quartz kindle
#

why Math.round

summer torrent
#

so i can do array.random() lol

summer torrent
quartz kindle
#

Math.round will give you incorrect results

#

lets say array length is 2, so Math.random() becomes a value between 0 and 2.
if you get 0.9 it should pick the first item, index 0

#

with Math.round you will get index 1

summer torrent
#

oh right

quartz kindle
#

and if you get 1.6 you will get index 2, which is an invalid index in an array of 2 items

wanton thunder
#

ight somebody who's experienced with having a bot i need some help lol

lusty quest
#

you grew to fast

summer torrent
wanton thunder
#

now i'm at 230 servers out of 250 but its still here lol

#

thanks nmw

lusty quest
#

im about to rent a Root server bcs its cheaper than a VPS, should i opt in for ECC memory? its only 6€ more/Month but im not entirely sure if i really need it.

wanton thunder
#

i host mine on vultr.com and its $5 a month with more than enough specs

#

its running linux ubuntu 18

#

then again, i wrote my bot in python so its very easy to pull from github on my server and run the main.py file

lusty quest
#

well ive wrote today a bot that uses tensorflow and i get spikes to 70-80% CPU usage while tensorflow is running, and this is only one guild. looked into a higher Performance CPU VPS at Digitalocean this will cost me 40€/Month for 4GB Ram and 2CPU cores, now i look at a Root server with a Ryzen 5 3600 and 64GB ram for 46€/month,with ECC Memory its 52€/Month

#

i could afford the 52€/Month but saving 6€ is quite a bit over the span of 12 Months

#

also i get way faster Storage i think, i guess Digitalocean uses Sata SSDs the Root server gets 2 512GB NVME SSDs

ebon dune
#

this is showing

#

can't get value

#

of

#

fetch

#

help pls

pale vessel
#

Epic

ebon dune
#

@solemn latch can u help me? please

solemn latch
#

Fetch returns a promise, so you are doing
Promise.send which makes no sense.

#

You will want to await it

ebon dune
#

cache.await

#

?

#

@solemn latch

solemn latch
#

No, I would suggest learning about javascript promises. Spending 30 minutes learning about them will save you a ton of time about them down the line

ebon dune
#

ok ty

fair axle
pale vessel
#

Filter it instead of using find and use .random() to it

#

collection.filter().random()

fair axle
#

What is difference between filter and find

mellow kelp
#

filter returns an array with the elements that "pass" the function you passed

pale vessel
#

filter() returns the collection of elements that passed the function you give and find only returns the first element of that

fair axle
#

Thanks

grizzled raven
#

find returns 1

#

i'm so helpful imcool

cobalt spruce
#
(node:15104) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
#

hmm

#

i got This Error

#
jointocreatechannel(newState);```
#

this are error lines

solemn latch
#

what is user?

cobalt spruce
#

Full Error

    at jointocreatechannel (C:\Users\Home\Desktop\bot\jointocreate.js:87:37)
    at Client.<anonymous> (C:\Users\Home\Desktop\bot\jointocreate.js:38:5)
    at Client.emit (events.js:315:20)
    at VoiceStateUpdate.handle (C:\Users\Home\Desktop\bot\node_modules\discord.js\src\client\actions\VoiceStateUpdate.js:40:14)
    at Object.module.exports [as VOICE_STATE_UPDATE] (C:\Users\Home\Desktop\bot\node_modules\discord.js\src\client\websocket\handlers\VOICE_STATE_UPDATE.js:4:35)
    at WebSocketManager.handlePacket (C:\Users\Home\Desktop\bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\Home\Desktop\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\Home\Desktop\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\Home\Desktop\bot\node_modules\ws\lib\event-target.js:132:16)
    at WebSocket.emit (events.js:315:20)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:7312) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7312) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
cobalt spruce
#

2nd

#

am making Temp Voice Channel

solemn latch
#

so user.channel is a custom property?

cobalt spruce
#

no

solemn latch
#

so then whats user? its not a User as that doesnt have a .channel property

cobalt spruce
#

Thx

#

let me take a look

solemn latch
cobalt spruce
#

the voice channel should be in a Category to Work

cobalt spruce
#

can i make the bot see the channels id from a json file?

solemn latch
#

sure, why not.

cobalt spruce
#

for ex
Command: /settemp CHANNEL ID

#

and then write it on a json file

#

and then use it

solemn latch
#

it would be much better to use a database

#

if your looking to store it

cobalt spruce
#

am looking to store it

#

but idk what db should i use

solemn latch
#

just mongo would be fine, or postgres if you want.

#

or enmap

cobalt spruce
#

which one is easiest?

#

i saw people use a package called quick.db

solemn latch
#

enmap is super easy afaik, but never used it.

#

quick.db is really not good right now

#

its a database with practically no features built in

cobalt spruce
#

why?

solemn latch
#

most databases have a reasonable set of features, quick.db doesnt have most of them.

#

and quick.db is no easier than any of the other ones.

quartz kindle
#

what does enmap have that quick.db doesnt?

solemn latch
#

🤷‍♂️ never used it, just trying to support evie lol

quartz kindle
#

ah xd

cobalt spruce
#

lol

#

what do u say tim?

#

which one is easiest

quartz kindle
#

ive never used either, but always though both of them were similar in many aspects

#

but from what i understood, evie correct me if im wrong, enmap keeps a copy of the dataset in memory, whereas quick.db doesnt

cobalt spruce
#

which db u use?

quartz kindle
#

sqlite

#

more specifically, better-sqlite3

cobalt spruce
#

for ex

#

!id GeneralVC

#

and it gives the id

drowsy grail
#

yea I believe enmap is just a data structure

slender thistle
#

sdoes d.js have gulid...voice_cnahells?

#

nvmi'm out

quartz kindle
#

???

drowsy grail
#

yes it does

solemn latch
#

shivs been drinking

safe spade
#

hello, I have a cool idea for the bot I would like to share. Where can I do that?

cobalt spruce
#

idk man

cobalt spruce
drowsy grail
cobalt spruce
#

;-;

quartz kindle
drowsy grail
#

what lib are you using?

quartz kindle
#

message.mentions.channels

drowsy grail
#

oh djs

quartz kindle
#

then what

cobalt spruce
#

a voice channel

quartz kindle
#

yes but you're gonna mention it?

#

oh you cant mention voice channels

#

then look for it by name

cobalt spruce
quartz kindle
#

guild.channels.cache.find()

drowsy grail
#

^

#

guild.channels.cache.find(channel => channel.name === channelName)
where channelName can be message.content.replace('!id ', '') or smth

#

and you can just get the id from the object that's returned

cobalt spruce
#

am dum

drowsy grail
#

oh does that make sense tho

cobalt spruce
#

nope

worldly creek
#

my bots on at wierd times till i can properly code it thats how lazy i am lul

eternal osprey
#

hey guys

#

const filter = m => m.content.includes('+') && message.author.id == targetMember.id why is this part not working?

earnest phoenix
#

what is wrong
message.guild.channels.cache.get(channelid).messages.fetch(messageid).then(message => message.react(stringmessage));

gilded olive
fair axle
#

How can I get random user who reacted message with 🎉

gilded olive
#

what language

mellow kelp
#

i smell giveaway bot

gilded olive
#

It is

#

lol

fair axle
#

node.js sorry

#

It is not giveaway bot it is just a feature

cobalt spruce
#

lol

eternal osprey
#

hey

#

why does tradepokemon log undefined? ```js
let tradepokemon;
collector.on('collect', m => {
tradepokemon = m.content

            });
            console.log(tradepokemon)```
quartz kindle
#

because thats a callback

#

you cant do that with callbacks

eternal osprey
#

owh shit.

#

how would i attempt to fix it?

quartz kindle
#

you cant

#

because a callback is setting up something to be executed in the future

eternal osprey
#

aha i understand.

#

so there is no way to define tradepokemon outside the collector?

quartz kindle
#

the code above basically does "whenever a collect happens, do this" and then proceeds normally until the end of the function

eternal osprey
#

because someone in this chat actually told me to use callbacks.

quartz kindle
#

it doesnt wait for the collection to happen

eternal osprey
#

but what should i do now, then?

quartz kindle
#

idk what you want to do with that variable

eternal osprey
#

do define it outside the scope.

eternal osprey
#

can show you the whole snippet on hastebin if needed.

quartz kindle
#

it cant function outside the collector

#

unless you create a promise around the collector and await it

eternal osprey
#

how would i promise it?

quartz kindle
#

what are you collecting anyway?

eternal osprey
#

just a pokemon id

quartz kindle
#

but what is it

eternal osprey
#

later on searching for it

quartz kindle
#

a message, a reaction?

eternal osprey
#

a message

#

starting with +

#

you need the snippet?

quartz kindle
#

is it like a command that asks for a reply from the user, then uses the reply?

eternal osprey
quartz kindle
#

dont use a collector

#

use awaitMessages

#

its the same as a collector but in promise form

eternal osprey
#

hmm okay i will try. Thanks

#

hey @quartz kindle

#

in the docs i only see collected.size being targeted.

#

how would i get the exact content?

#

collected.content?

quartz kindle
#

dont use collectors

eternal osprey
#

i am using awaitmessage

quartz kindle
eternal osprey
#
 let m = message.channel.send(targetMember + "What pokemon do you want to trade for: " + found.name + "?. Only input your pokemon-name, starting with +. Example: ``+Charizard``.")
                const filter3 = m => m.content.startsWith('+');  
                message.channel.awaitMessages(filter3, { max: 1, time: 15000, errors: ['time'] })
                .then(collected => console.log(collected.size))```
#

yeah i have that page open too

quartz kindle
#

dont use .then

#

use await

#

otherwise you wont be able to store the variable you want

eternal osprey
#

okay.

quartz kindle
#

collected is a collection of returned items

#

if you just have 1 item, just use collected.first()

eternal osprey
#

aha okay

#

yeah never worked with awaitmessages, so i am kinda bad.

#

so instead of then i should use await

#
let m = await message.channel.send(targetMember + "What pokemon do you want to trade for: " + found.name + "?. Only input your pokemon-name, starting with +. Example: ``+Charizard``.")
                const filter3 = m => m.content.startsWith('+');  
                message.channel.awaitMessages(filter3, { max: 1, time: 15000, errors: ['time'] })
                (collected => console.log(collected.size))```like this
quartz kindle
#

yes, otherwise you will have the same problem as the callback in the collector

#

no

quartz kindle
#

you're not awaiting it

#

let collected = await message.channel.awaitMessages(...)

eternal osprey
#

ooowh okay

#
let collected = await message.channel.awaitMessages(filter3, { max: 1, time: 15000, errors: ['time'] })
                (collected => console.log(collected.size))```and i can assign a variable to collected.size named tradepokemon
#

uhhm

#

TypeError: message.channel.awaitMessages(...) is not a function

#

@quartz kindle

quartz kindle
#

why do you still have that .then line?

#

remove it

eternal osprey
#

(collected => console.log(collected.size))

earnest phoenix
#

Hey tim what bot did u make?

eternal osprey
#

this one? But how would i ever get the collected size then?

earnest phoenix
#

i put my bot on top gg how long does it take

quartz kindle
#

i have 3 bots, my main bot is called Astrobot

earnest phoenix
#

how big

#

how many guilds

quartz kindle
#

it takes about 1 week to be approved

earnest phoenix
#

ok\

quartz kindle
#

about 7k

earnest phoenix
#

nice

#

if i get my bot verified will i get badge?

quartz kindle
#

no

earnest phoenix
#

once it hits 100

quartz kindle
#

the badge is not related to top.gg

gilded olive
#

Discord dosent do that anymore

earnest phoenix
#

no

quartz kindle
#

once your bot is verified by discord, your bot will get the verified bot badge

#

you as the developer wont get anything

#

you can apply for verification with discord once it reaches 75+ guilds

gilded olive
#

So sad how it was removed

solemn latch
#

it was removed for good reason

restive furnace
#

bcs folks just verified bcs the badge

gilded olive
#

Not really

#

Maybe if they bumped up requirements

restive furnace
#

well many people did

gilded olive
#

It wouldnt have been that exploitable

#

youve seen it here people getting over 75 guilds in a few days to just 1 week

eternal osprey
#

Hey Tim, i tried fixing the function but it literally returned shit,

solemn latch
#

people sold servers for your bot to join to get verified.

quartz kindle
#

and then get denied because inorganic growth

eternal osprey
#
let m = message.channel.send(targetMember + "What pokemon do you want to trade for: " + found.name + "?. Only input your pokemon-name, starting with +. Example: ``+Charizard``.")
                const filter3 = m => m.content.startsWith('+');  
                let collected = await message.channel.awaitMessages(filter3, { max: 1, time: 15000, errors: ['time'] })
                let tradepokemon = collected
              console.log(collected)```
earnest phoenix
#

i wanna verify so more people trust my bot

eternal osprey
gilded olive
#

That would be fixed by just bumping up the requirement

#

175 guilds?

earnest phoenix
#

or 200

#

whatever

gilded olive
#

200 may be a stretch

solemn latch
#

it would have been in the thousands imo

restive furnace
#

5000 is fine

quartz kindle
solemn latch
#

people pay hundreds of dollars to buy accounts with the badge, they are valued quite highly

gilded olive
#

Bruh moment

eternal osprey
#

and id

#

but it did not save apparently?

solemn latch
#

imagine getting paid to make thousands of servers just so someone could get the badge KEKW

gilded olive
#

Ah yea I know someone with all badges except staff and he says people come to his dms offering thousands of dollars

earnest phoenix
#

i just want the check on my bot so that people trust my bot\

#

and add it to more servers

quartz kindle
#

you will get the check once you pass discord's verification process

gilded olive
#

(the check imo dosent really affect anything)

solemn latch
#

but the badge does?

#

lol?

earnest phoenix
#

what is the process?

eternal osprey
quartz kindle
#

you will get a dm from discord once your bot gets to 75 servers

gilded olive
#

the badge maybe probably

earnest phoenix
#

can i verify my bot if i am under 18

#

?

quartz kindle
#

yes

earnest phoenix
#

i am 15

#

ok

quartz kindle
#

but you will need to provide proof of identity

earnest phoenix
#

i have ssn ?

#

will that work

#

or shcool id

quartz kindle
#

i think they require an id with a photo

earnest phoenix
#

i have highschool id

gilded olive
#

Tim about that proof of identity, what about if you have team members

quartz kindle
#

you can try

gilded olive
#

Everyone has to provide it?

earnest phoenix
#

ok

#

whats the point of it

quartz kindle
#

should be only the team leader/owner

gilded olive
#

Ah alr

earnest phoenix
#

so when my bot reaches 75

#

i get a dm

#

@quartz kindle ?

quartz kindle
#

yes

earnest phoenix
#

automated

#

?

quartz kindle
#

yes

eternal osprey
#

@quartz kindle i can't get it to work tbh

#

 let m = message.channel.send(targetMember + "What pokemon do you want to trade for: " + found.name + "?. Only input your pokemon-name, starting with +. Example: ``+Charizard``.")
                const filter3 = m => m.content.startsWith('+');  
                let collected = await message.channel.awaitMessages(filter3, { max: 1, time: 15000, errors: ['time'] })
                let tradepokemon = collected
              console.log(collected)```
#

i literally input +3953953

#

but as soon as the m message gets sent, it collects it.

#

but i still need the time to get the input ready.

#

can we maybe fix that using await in the let m'=

wicked pivot
#

how to clear what is in a file with fs?

quartz kindle
#

i g2 take a phone call

eternal osprey
#

ey it worked!

dire obsidian
#

This would sound ridiculous but

#

How import typescript to html?

cinder patio
#

you don't import typescript, you transpile typescript to javascript and then include the transpiled javascript in your HTML file via a <script> tag

dire obsidian
#

K thanks

eternal osprey
cinder patio
#

collected.first() will return the first message that got collected

#

you should know how to get the content from there @eternal osprey

grizzled raven
#

anyone know how long it takes for your bots card in google search results to update?

gilded olive
#

1h

quartz kindle
#

vertical-align: top

sterile lantern
#

how do i delete a slash command

#

i cant do it via shell

#
bash: syntax error near unexpected token `"theidishere"'```
#

ignore the idishere, its numbers but i removed it

#

this doesnt list the cmds

quartz kindle
#

what does it return

#

also, you're doing this from the shell? wtf

sterile lantern
#

shell?

#

oh

#

i mean index.js

#

i did console.log

#

prompise pending

#

promise*

quartz kindle
#

you need to await it

sterile lantern
#

it prints

#

[]

#

ah

#

need to specify guild

#

one sec

#

found it thanks!

#

how would i delete it

#

i get

#

unknown app command

earnest phoenix
#

@earnest phoenix

earnest phoenix
#

Hm ya guys know a way to make a dm help command?

solemn latch
#

no spoonfeed

#

also, might not be using js

earnest phoenix
#

Im using js

#

Thanks I guess, wasn’t wanting spoon feed but thanks lol

distant cobalt
#

how come it adds a digit instead of a number?

var mgsspn = '0'
mgsspn = mgsspn + 1```
earnest phoenix
#

Hm, what language?

#

Is it

distant cobalt
#

Djs

earnest phoenix
#

Guessing it’s the plus

distant cobalt
#

?

earnest phoenix
#

Try removing the plus and then try @distant cobalt

distant cobalt
solemn latch
#

'0' is a string, so its treating '1' as a string.

distant cobalt
#

k

#

removed the ' '

earnest phoenix
#

That's wrong.
The const must be like this:

const help = new Discord.MessageEmbed();
solemn latch
#

you can use either

#

both are correct

earnest phoenix
#

Oh

#

I didn't know that lol

distant cobalt
#

it's still doing that thing

earnest phoenix
#

Oh right

distant cobalt
#

k

solemn leaf
gilded olive
solemn leaf
#

'0' is a string

#

so adding 1 to it

#

will make it "01"

#

that is kinda common sense to me

solemn latch
#

oh would typescript get mad about that?

solemn leaf
#

good

#

it should

solemn latch
#

i dont think it should 🤔

#

most the TS errors make sense to me, but if anything automatic string concatenation seems useful.

#

not that it really matters since you can freely convert between the two anyway

earnest phoenix
#

So uh why is this not working a.

#

?

solemn latch
#

any errors?

#

op

#

i see it

earnest phoenix
#

Hm?

solemn latch
#

when you require MessageEmbed you misspell it.

earnest phoenix
#

Oh caps right?

solemn latch
#

Message is mispelled.

solemn leaf
#

No

earnest phoenix
#

Ohh I’m E

#

Lol

solemn leaf
#

you just cant spell

earnest phoenix
#

It’s the E

solemn leaf
#

the e

solemn latch
#

who needs spelling ;p

solemn leaf
#

correction

earnest phoenix
#

Why can’t I spell?

#

Just because a misspell

solemn leaf
#

google translate for vs

solemn latch
#

i had to google concatenation because i couldnt remember how to spell it pandasad

earnest phoenix
#

@solemn latch YOOOO CONGRATS IT WORKED! 😄

#

Lol

solemn leaf
#

no body cares

solemn latch
#

thanks for the congratulations

#

lol

solemn leaf
#

you legit mispelled

#

you should get a real code editor and it would tell you that

earnest phoenix
#

Bruh why are you acting like this?

solemn latch
#

looks like the editor is just the repl website

#

probably easier in this case.

earnest phoenix
#

Yea well that’s the best... I am iPad

#

I wished I also had visual studio code

#

Would’ve been better

solemn latch
#

i thought iPad supports vsc

#

that might have been a meme? no idea.

solemn leaf
#

It might have vs

#

not vsc

earnest phoenix
#

Uh my repl.it just died after I used that command

solemn leaf
#

but honestly you should double check spellings before asking here

earnest phoenix
#

Yes well I’m a bit blind LOL

solemn latch
#

what error was logged?

earnest phoenix
zenith terrace
#

but did you add a color in the .setColor?

#

although that shouldnt kill a rpel project

solemn latch
#

lol, how did i miss that

earnest phoenix
#

Loll

zenith terrace
#

so did you add a colour or just keep it as "your color here"

earnest phoenix
#

Fixed

#

Now let’s see if it dies again

solemn latch
#

it helps to keep the console page open in another tab so you can quickly see logged errors.

zenith terrace
#

imagine missing the most simplest thing Woo

earnest phoenix
#

@zenith terrace yes lmao I’m kinda blind

solemn latch
#

i read it in order and stopped as soon as i saw an error.

zenith terrace
earnest phoenix
#

It works but then dies right after

zenith terrace
#

whats the error

earnest phoenix
#

That’s is big error

zenith terrace
#

ah its that

earnest phoenix
#

Hm? What is it

zenith terrace
#

its in your index.js file

earnest phoenix
#

I get this error daily lol

#

Which line?

zenith terrace
#

38 it says

solemn latch
#

since the message happened in a direct message, the message.guild doesnt exist

#

and is null

earnest phoenix
solemn latch
#

.guild is nullable, so it should be treated as such.

earnest phoenix
#

So what do you see wrong with 38?

#

Sorry I’m a newbie

zenith terrace
#

so as Woo said, since you are sending the embed into the users DMS, message.guild doesnt exist

earnest phoenix
#

So I should delete it

solemn latch
#

personally i would use optional chaining, and an inline if statement.

earnest phoenix
#

Hm, I got no idea so uh should I delete would it effect any other commands?

zenith terrace
#

since you are new to coding I recommend just sending the help embed in the channel the command is run on

earnest phoenix
#

Aw. But what would happen if I delete it?

#

Line 38 ^

solemn latch
#

you would never have a prefix

earnest phoenix
#

LOL

#

Aw man

#

I really wanted a dm help command

#

I guess I’ll change it

solemn latch
#

i mean, could just fix the error

solemn leaf
#

@earnest phoenix you can

earnest phoenix
#

What? But I have no idea what to do with it since I’m a Newbie

solemn leaf
#

just have another event for message

#

cant you just do that

#

lol

earnest phoenix
#

Well I’m not that pro I don’t know the coding for that LOL

solemn leaf
#

its in your index

solemn latch
#

or just use optional chaining 🤔

solemn leaf
#

you can

solemn latch
#

optional chaining is super simple

solemn leaf
#

you can do a switch

earnest phoenix
#

So uh which line btw? @solemn leaf

solemn leaf
#

I aint helping you fool

earnest phoenix
#

Lol...

solemn leaf
#

ill walk you through it

#

not help you

earnest phoenix
#

45?

#

Ok..

#

I have to sleep soon let’s try to do it fast

#

I’ll have to go...

solemn latch
#

the solution i was thinking of was just
const prefix = get({msg.guild?.id}) || "defaultprefix";

#

would be a clean solution and solve the issue without messy double event listeners.

#

well, actually that doesnt work KEKW

#

but using a ternary it would

#

talking to myself at this point, but does quick.db error with a undefined input? i thought it errored, but cant remember anymore.

dusky sundial
#

Someone help

#

maria is leaving me :(

#

mariadb.InterfaceError: MySQL server has gone away

earnest phoenix
fierce ether
#

whats best way make a website off localhost?

unique mulch
#

when I try to invite my bot to a server that's not mine, it says that the OAUTH2 requires a code grant. How do you fix that?

solemn latch
#

disable the code grant setting in the dev portal.

glacial pagoda
#

Help

#

In if(!message.GuildMember.hasPermission

unique mulch
#

thanks :)

solemn latch
glacial pagoda
#

ill try that

#

Thank You So Much @solemn latch

#

You Should Get a Staff Promo

#

Your The Best!

solemn latch
#

development doesnt really mean anything here staff wise.

glacial pagoda
#

lol

#

You Should Be a Mod Then

solemn latch
#

for the time being, not looking to get mod. bot reviewing is already enough work.

glacial pagoda
#

Well You Should Consider

glacial pagoda
#

I Tried Rearranging it

solemn latch
#

whats your command.execute look like? in the index.js

#

or main file

glacial pagoda
solemn latch
#

you saved both files right?

glacial pagoda
#

wdym

#

yeah

earnest phoenix
#

B

solemn latch
#

so, if you want, you can just require discord again in your ban file and not pass it in the execute function, will work just as well.

glacial pagoda
#

i did the code again and didnt work

#

how do you not pass it in the execute funtion

#

what should it look like

solemn latch
#

looks fine to me, your other option is logging Discord before the execute and see if its the right variable.

glacial pagoda
#

i-

#

what

#

@solemn latch

solemn latch
#

most likely command didnt have perms to add a role to that member.

glacial pagoda
#

it did doe

#

the bot has admin

#

perm

solemn latch
#

is it trying to modify an owner?

glacial pagoda
#

i dont think so

#

wait lemme create a role and give it to the bot