#development

1 messages · Page 994 of 1

steep garnet
#

@opal plank.

opal plank
#

again, console log those two variables i stated before

steep garnet
#

doing it.

opal plank
#

try this command and see the output, on a test command or on that one

steep garnet
#

what command?

opal plank
#

translate.getText('esto es una prueba',{to: 'en'}).then(function(text){
console.log(text)
});

#

either a eval or a test command

steep garnet
#

ok.

opal plank
#

then its the to:'en' part

#

its likely 'en-US' not 'en'

#

try this

#
    console.log(text)
  });```
steep garnet
#

okkkk.

#

lol.

opal plank
#

my bad, theres a space

steep garnet
#

?

#

where

opal plank
#

hmmm actually, no, im checking the docs

earnest phoenix
#

@_@

steep garnet
#

i literally just copy + pasted.

opal plank
#

one sec

steep garnet
#

?

opal plank
#
    console.log(text)
  });```
#

doubt a space might make a difference, but it might be

steep garnet
#

space, where?

opal plank
#

to: 'en' =/= to:'en'

#

in the previous snippet i gave you i did not put space in between

steep garnet
#

i don't think it would make a difference lol.

opal plank
#

me neither but idk how their parser works

steep garnet
#

yeah, how i supposed.

#

another error.

opal plank
#

are you awaiting it?

steep garnet
#

no.

#

lmao.

opal plank
#

do it

steep garnet
#

ah sh.

slender birch
#

someone can help my discord to grow up???

steep garnet
#

can i curse on the server¡

#

@slender birch, not rlly.

slender birch
#

oof

lusty quest
#

@slender birch add the bot to the page and hope its unique enought to get attraction

opal plank
#

its not an easy feat, mine is unique yet doesnt get enough discovery to go up

slender birch
#

thanks for your help

lusty quest
#

ive got ~50 guilds in 3-4 weeks

steep garnet
#

@opal plank, i want to make my bot unique.

opal plank
#

mine is at 33 currently

steep garnet
#

but as you can see, a lot of competence.

lusty quest
#

im at 94

#

and a second one is in the works

opal plank
#

mine has features that no other bot has, yet its still very small to get recommended around

slender birch
#

i am at 25

pure lion
#

@steep garnet why not use a different API?

opal plank
#

advertising is annoying, i dislike going around asking people to try it

steep garnet
#

mine just 2.

lusty quest
#

add some way to reward voting. its more likely to get added with more votes

steep garnet
#

@pure lion, bc the other one is worst.

pure lion
#

I'm at 31

opal plank
#

i already got that in place for the minigames

pure lion
#

@steep garnet it's not? How is it worse?

lusty quest
#

i had also a good start. the First server that used my bot got 10k users

steep garnet
#

mah, it throws the same error all the time.

pure lion
#

Oooo nice

opal plank
#

they are getting the same error regardless of the api, told me to await the promise

steep garnet
#

anyway @opal plank, where do i actually put the await?

pure lion
#

mah, it throws the same error all the time.
@steep garnet I'll link an NPM

opal plank
#

you need to make it async first

pure lion
#

^

steep garnet
#

ik.

#

but where do i put the await now?

opal plank
#

on... the promise

pure lion
#

client.on('message', async () {} )

opal plank
#

not even, just turn it into an async func

#

running async code in an sync block, 200iq

steep garnet
pure lion
#

I always get those mixed up lol

#

That's good shark

opal plank
#

async func() Something {
await //ur stuff
}

steep garnet
#

ye, i knew where to put it.

opal plank
#

then you can run is sequentially

steep garnet
#

anywayyyy

#

lets run this thing.

opal plank
#

did you await the promise?

steep garnet
#

:|

opal plank
#

you only added async from what i saw

steep garnet
#

ah sh, here we go again.

opal plank
#

they are getting the same error regardless of the api, told me to await the promise

#

await can only be used in async

#

you added async, add await on the promise now

steep garnet
#

oh, nice.

#

nice.

#

wait a minute.

opal plank
#

unhandled promise, its the error

#

dude

#

no

steep garnet
#

:(

opal plank
#

you cant .then an await

#

.then calls it right away

steep garnet
#

then what i do?

#

:(

opal plank
#

spoonfeeding

steep garnet
#

:(

#

just explain.

opal plank
#

to put it simply

hazy sparrow
#

this code should output a number from 1-6, but instead its outputing the code itself

opal plank
#

sync code cannot wait for async code or wait for promises with .then
async code can wait for sync code but cannot wait for promises .then
promises with .then can wait for async and sync iirc

steep garnet
#

mhm.

opal plank
#

you have absolutely no idea what i just said, do you?

steep garnet
#

:(

opal plank
#

ugh, fine, heres an example, learn from it

steep garnet
#

idk why i'm here in first place.

opal plank
#

let something = await translate.getText(textToTranslate, (to: langToTranslate))
console.log(something)

#

we arent suppose to spoonfeed you

#

spoonfeeding only creates vampires

steep garnet
#

lmao.

opal plank
#

aka you come back next time you get stuck

steep garnet
#

ik what's spoonfeeding.

#

i'm on a Lua server.

#

idrk a lot of js.

opal plank
#

you need to learn promise handling on js

#

its quite important basics

steep garnet
#

perfect, next task.

opal plank
#

sync and async code blocks

steep garnet
#

ty so much. 👍

opal plank
#

np

hazy sparrow
#

can someone help me

glossy elk
#
let cmd = client.commands.get(command)
      try {
      delete require.cache[require.resolve(`../../commands/${cmd.category}/${commandfile}Command.js`)] 
      client.commands.delete(command)
      const pull = require(`../../commands/${cmd.category}/${commandfile}Command.js`)
      client.commands.set(cmd.name, pull);
      cmd.aliases.forEach((alias) => {
      client.aliases.set(alias, pull);
      });
    } catch(e) {
      console.log(e)
    }
      message.channel.send({embed: {
        color: client.color,
        description:`The command \`${args[0].toUpperCase()}\` has been reloaded!`
      }})``` creating a reload command, returns command is reloaded but in teh message event command.run is not a function only for that command specifically..
hazy sparrow
#
const client = new Discord.Client();

client.on("ready", () => {
  console.log("I am ready!");
});

const rollDice = () => Math.floor(Math.random() * 6) + 1

const prefix = "bow";
client.on("message", (message) => {
  if (!message.content.startsWith(prefix) || message.author.bot) return;
  if (!message.content.startsWith(prefix)) return;
 
  if (message.content.startsWith(prefix + "ping")) {
    message.channel.send("pong");
  
  } else
  if (message.content.startsWith(prefix + "foo")) {
    message.channel.send("bar!");

  } else 
     if(message.content.startsWith(prefix + "roll")); {
    message.channel.send("rolled a" + rollDice);
    }
  
}); 
#

each command here executes "rolled a = () => Math.floor(Math.random() * 6) + 1"

#

for some reason

idle mountain
#

probably gotta remove the ; on this line:

#

if(message.content.startsWith(prefix + "roll")); {

hazy sparrow
#

ok ill test that

glossy elk
#

dum restart

#

oops wrong channel

hazy sparrow
#

@idle mountain it works (thx) but the roll comand executes "rolled a = () => Math.floor(Math.random() * 6) + 1"

#

instead of a number from 1 to 6

earnest phoenix
#

How to make our bot display the number of servers where it is present ????

pure lion
#

Is there a way to periodically log a value into quick.db, e.g:

(User side) !disable (command name)

(Table name = command name blacklist)
*Add guild id to DB*

A different server:

!disable (same command)

Unsure if it would overwrite, and how I would write correctly

#

Fox, wants your lib?

earnest phoenix
#

Yes but i didn't find

pure lion
#

What is your library

earnest phoenix
#

discord.js

pure lion
#

Ebic

#

client.guilds.cache.size

earnest phoenix
#

Thanks

pure lion
#

Np

dusky mist
#

some1 know why my discord bot token is changing all the time?

idle mountain
#

you mean when you refresh the page?

dusky mist
#

yes

idle mountain
#

it refreshes every time you refresh the page, that's normal

#

old tokens will still work until you click regenerate

dusky mist
#

the problem is that it doesnt work

idle mountain
#

then there's a different problem in your code

#

it's showing unauthorized?

#

click regenerate and try again

#

part of the token hash is a timestamp of when it's generated, so there's a different token for every second (or millisecond)

dusky mist
#
  <rejected> Error [TOKEN_INVALID]: An invalid token was provided.
      at Client.login (/home/runner/gfdsgfds/node_modules/discord.js/src/client/Client.js:204:52)
      at /home/runner/gfdsgfds/index.js:36:8
      at Script.runInContext (vm.js:131:20)
      at Object.<anonymous> (/run_dir/interp.js:156:20)
      at Module._compile (internal/modules/cjs/loader.js:1133:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
      at Module.load (internal/modules/cjs/loader.js:977:32)
      at Function.Module._load (internal/modules/cjs/loader.js:877:14)
      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
      at internal/main/run_main_module.js:18:47 {
    [Symbol(code)]: 'TOKEN_INVALID'
  }
}```
#

i have the token in an .env file like this: "token=token"

#

and then i have in the main code: client.login(process.env.token);

#

its all ok but it doesnt work

hazy sparrow
#

try using the new token

dusky mist
#

i did it a bunch of times

#

it throws an error everytime

haughty night
#

Try console logging your token and see if its the correct one

dusky mist
#

Try console logging your token and see if its the correct one
@haughty night i did it but it didnt log it in. It throws that message in console:

#

oops

#

its too large

#

im not a professional but i know what i do

haughty night
#

Did you do console.log(process.env.token)?

dusky mist
#

yes

haughty night
#

And the error is in that text file?

#

Gotta grab my pc then, my phone doesnt want to open the file

trail finch
#

hello

#

umm what is the best and free way to make a bot online?

dusky mist
#

in that text file is the message it throws on the console when i do console.log(process.env.token)

#

i cant now wait pls

haughty night
#

@dusky mist That file looks more like you consoled logged your client

#

Like console.log(client)

#

That is the response you would get when console logging your client

dusky mist
opal plank
#

hmmmm

#

i really dislike environmental variables, but i guess

dusky mist
#

@haughty night i just changed in client.login() the process.env.token for the real token, now it doesnt throws an error but it doesnt work

pure lion
#

When I try to push a guild ID in my quick.db, it returns 'target is not an array'. How would I fix this?

haughty night
#

I was just about to ask if you could do that

#

Uuuh so

#

Try regenerating the token and try again

dusky mist
#

ok

#

it worked

#

but with the real token in client.login()

haughty night
#

Nice, so the problem lies with the env

#

How does your .env look like

#

Can show me, without the token ofcourse

dusky mist
#

yes ofc

opal plank
#

hmmm

#

just out of curiosity

#

this is what you have in your code, right/

#

?

dusky mist
#

its just like this: "token=token"

opal plank
#

client.login(process.env.token)

dusky mist
#

yes

opal plank
#

recommendation, use a json file

haughty night
#

do this token=token without the ""

dusky mist
#

the problem is that i use repl.it and the project is public

#

if i do it in json file ppl could know my token

#

do this token=token without the ""
ok

opal plank
#

why not simply exclude json from the list?

#

i also have github for example, you can exclude specific files from being shared

dusky mist
#

how can i do that?

haughty night
#

.gitignore

opal plank
dusky mist
#

do this token=token without the ""
it throws an error but its tiner than the other one

haughty night
#

What does the error show

dusky mist
#
  <rejected> Error [TOKEN_INVALID]: An invalid token was provided.
      at Client.login (/home/runner/gfdsgfds/node_modules/discord.js/src/client/Client.js:204:52)
      at /home/runner/gfdsgfds/index.js:33:8
      at Script.runInContext (vm.js:131:20)
Hint: hit control+c anytime to enter REPL.
Promise { <pending> }```
opal plank
#

@steel wedge repeating the same question within 5 mins wont help you much

dusky mist
#

its the same error

#

but the other one was larger

#

i dont rlly know whats happening

#

i will try do: token="token"

opal plank
#

its expecting a string

#

client.login('someStringyTokenHere')

#

doing client.login(SomeStringyTokenHere) wont work

dusky mist
#

hey it worked without ""

opal plank
#

let token = process.env.token
client.login(token)

dusky mist
#

but before it didnt

#

lmao

restive furnace
#

in .env it doesnt need ""

dusky mist
#

solved!

#

tysm guys

hazy sparrow
#

whats the most simple way to execute a random number between X and Y

glossy elk
#
Error: Cannot find module '../../commands/undefined/HelpCommand.js'
``` i tried console logging it and it returns the right category
```js
        console.log(client.commands.get(command).category)
onst category = client.commands.get(command).category
        const pull = require(`../../commands/${category}/${commandfile}Command.js`)```
full code: ```js
 try {
        console.log(client.commands.get(command).category)
        const category = client.commands.get(command).category
        const pull = require(`../../commands/${category}/${commandfile}Command.js`)
        delete require.cache
      
      client.commands.delete(command)
     
      client.commands.set(args[0].toLowerCase(), pull);
      let cmd = client.commands.get(args[0].toLowerCase());
        if(cmd.aliases === undefined) {

        } else {
          cmd.aliases.forEach((alias) => {
            client.aliases.set(alias, pull);
            });
        }
     
    } catch(e) {
      console.log(e)
    }
    console.log('xd')
      message.channel.send({embed: {
        color: client.color,
        description:`The command \`${args[0].toUpperCase()}\` has been reloaded!`
      }})
          ```
opal plank
#

Error: Cannot find module '../../commands/undefined/HelpCommand.js'

#

bad path

restive furnace
#

undefined

opal plank
#

undefined category

glossy elk
#

no no

#

category

#

when i log it

#

it returns utility

#

soo ye

#

@restive furnace @opal plank

hazy sparrow
#

can someone help me?

restive furnace
#

i dontk now then

haughty night
#

Math.floor(Math.random() * X) + Y

hazy sparrow
#

ill try that brb

opal plank
#

will that even work?

pure lion
#

When I try to push a guild ID in my quick.db, it returns 'target is not an array'. How would I fix this?

glossy elk
#

so no one can help

opal plank
#

x = 10
y = 20

math.floor(0.1 * 10) + 20

#

well, im too sleepy for coding now

#

cya'll o/

pure lion
#

ok cya

hazy sparrow
#

its always giving 6

pure lion
#

but can someone help me with quick.db

#

Math.random() * rand2) + rand1

#

@hazy sparrow

hazy sparrow
#

(Math.random() * rand2) + rand1
@pure lion it but rand2 as 6 and rand1 as 1

#

its always giving 6

pure lion
#

rand 1 = 1 rand2 = 6

hazy sparrow
#

oof i know the problem now

#

ty

pure lion
#

np

opal plank
earnest phoenix
#

Hello i want to create a dashboard for my bot. Do you have a site for me ?

opal plank
#

@hazy sparrow

haughty night
#

Well my bad, Math.floor(Math.random() * (max- min + 1) + min)

hazy sparrow
#

.

#

ill try that wait

opal plank
#

always use docs

#

¯_(ツ)_/¯

pure lion
#

Hello i want to create a dashboard for my bot. Do you have a site for me ?
@earnest phoenix uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

hazy sparrow
#

Well my bad, Math.floor(Math.random() * (max- min + 1) + min)
@haughty night it works, tysm

haughty night
#

no worries

pure lion
#

btw

#

when i try to log something in my quickdb, it shows that its in an array (```js
[ { ID: "GuildID'S", data: [ '710964023117479966' ] } ]

```cmd
TypeError: Target is not an array.

help

lusty quest
#

is the field you want to send data to a field that allows arrays?

pure lion
#
        disabledSnipeDB.push('GuildID\'S', msg.guild.id)
lusty quest
pure lion
#

Okay thx

hazy sparrow
#

is there a way to make a bot online and run without the command window running?

pure lion
#

Ehhhhh

#

Didn't work @lusty quest

#

I'll make it a template string maybe? ${}

lusty quest
#

idk never used quickdb. cant help you that much with it

#

@hazy sparrow what language?

hazy sparrow
#

discord.js

#

or node.js whatever

lusty quest
#

linux or windows?

hazy sparrow
#

windowa

#

windows

golden condor
#
Error: Connection reset by peer
    at Shard._onWSClose (C:\Users\callu\TutorialBot\node_modules\eris\lib\gateway\Shard.js:1853:23)
    at WebSocket.emit (events.js:315:20)
    at WebSocket.emitClose (C:\Users\callu\TutorialBot\node_modules\ws\lib\websocket.js:194:10)
    at Receiver.receiverOnFinish (C:\Users\callu\TutorialBot\node_modules\ws\lib\websocket.js:790:20)
    at Receiver.emit (events.js:315:20)
    at finish (_stream_writable.js:645:10)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on Client instance at:
    at Shard.emit (C:\Users\callu\TutorialBot\node_modules\eris\lib\gateway\Shard.js:2111:26)
    at Shard.disconnect (C:\Users\callu\TutorialBot\node_modules\eris\lib\gateway\Shard.js:118:18)
    at Shard._onWSClose (C:\Users\callu\TutorialBot\node_modules\eris\lib\gateway\Shard.js:1863:14)
    at WebSocket.emit (events.js:315:20)
    [... lines matching original stack trace ...]
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  code: 1006
}```Hi I keep getting this error with eris and I don't know how to fix it (I think it is from discord resetting the connection) does anyone know how to fix it/handle it?
kind sedge
#

I agree

lusty quest
#

either use Docker (requires Windows 10 Pro) or start it as a service

hazy sparrow
#

ok can i start it as a service in windows 7

lusty quest
#

its possible but i cant tell you how. i use linux

pure lion
#

@golden condor server/sharding issue?

golden condor
#

Is there anyway to handle the Connection reset by peer error or to fix it

hazy sparrow
#

ok that helps ty

lusty quest
#

you can set a timeout and reconnect

golden condor
#

server/sharding issue?
I'm not sure, I've been getting this error with all my bots in eris

pure lion
#

Hmmmm

lusty quest
#

did you run it from your PC or a Server?

pure lion
#

^

hazy sparrow
#

me?

lusty quest
#

nope

hazy sparrow
#

ok

golden condor
#

did you run it from your PC or a Server?
@lusty quest my pc

lusty quest
#

its possible your connection cant handle it

golden condor
#

But I get the same issues on a server

lusty quest
#

hmm

#

enable the debug event

#

then see if it catches something

golden condor
#

Ok

#

client.on("debug", console.log) ?

#
undefined 1593163708678 /gateway 200: 138ms (463ms avg) | 1/1 left | Reset 1593163708678 (0ms left)
{"op":2,"d":{"token":"MY TOKEN HERE","v":6,"compress":false,"large_threshold":250,"guild_subscriptions":true,"properties":{"os":"win32","browser":"Eris","device":"Eris"},"presence":{"game":null,"status":"offline"}}} 0
{"op":1,"d":0} 0
The bot is ready!
{"op":1,"d":4} 0```
lusty quest
#

seems to login

golden condor
#

yeah

#

But then after a few hours

lusty quest
#

maybe a memory leak

golden condor
#

It exits with the Connection reset by peer

#

It is a simple bot

lusty quest
#

or some sort of rate limit

golden condor
#

It is a bot I use for a tutorial

#

It has one command

#

And one package

#

Which is eris

#

so I think that should be fine

lusty quest
#

thats strange

golden condor
#

it has happened with the past 2 bots I tried with eris

#

And I tried hosting on glitch, repl.it, local, rpi and vps so I am really confused

pure lion
#

That's annoying and strange

viral spade
#

When running a discord.js bot on multiple machines, can somehow be assured that every guild will always be handled by the same machine? Right now increasing the number of shards will rearrange the guilds accross the machines due to the shardingformula.

golden condor
#

That's annoying and strange
@pure lion yes itis

lusty quest
#

why did you care about having the same guild on the same server?

viral spade
#

because then i can have a databse on that server for that guilds

golden condor
#

why not use one linked database

lusty quest
#

i dont think this is possible usually you have one database for all servers

viral spade
#

i need to separate the data, shard it

lusty quest
#

if you have issues with bandwdh shard the database

golden condor
#

You could create a REST API and connect it to one central server

lusty quest
#

or use MongoDB. you can make a sharded database that connects to one endpoint. where it loadbalances the querys

earnest phoenix
#

what yous talking bout im confused

viral spade
#

the queries should not be loadbalanced, the need to be fixed according to the sharding key

golden condor
#

Why does this only happen with eris and not d.js

viral spade
#

so do people create multiple bots for this maybe? i mean i could easily let one bot with one local database go to 100k servers and simply create a new bot and exchange the invite link everywhere

lusty quest
#

i dont get your issue. MongoDB should handle it.

pure lion
#

@earnest phoenix if you came here to vibe, just leave

golden condor
#

is there anyway to handle it, so that the connection resumes?

lusty quest
#

not really they have a Database Cluster the Shard Servers connect to

earnest phoenix
#

nah im good I asked what going on

golden condor
#

oh wrong person

#

sorry

#

@earnest phoenix go to #general if u wanna talk

pure lion
#

is there anyway to handle it, so that the connection resumes?
client.on('disconnect'

golden condor
#

oh

pure lion
#

Wait nvm

#

Unless Eris works like that?

golden condor
#

lemme see

pure lion
#

If there's a way to execute code when the bot disconnects just run the login thingy

lusty quest
#
client.on('shardDisconnect', (event, shardID) => {
    setTimeout(() => client.destroy().then(() => client.login(process.env.BOT_TOKEN)), 60000)
    console.log(`[DISCONNECT] ${get_date(new Date())} Notice: Shard ${shardID} disconnected from gateway with code ${event.code} - Attempting reconnect.`)
})
#

try this

#

if the bot crashes it reconnects after a delay

pure lion
#

How is Eris different from djs?

lusty quest
#

(you probably need to edit the console.log bcs there is a function running in it for formating the date)

#

idk

golden condor
#
client.on("error", (error, id) => console.log(`An error occured: ${error}`))
client.on("disconnect", () => console.log("Disconnected"))
client.on("shardDisconnect", (error, id) => console.log(`An error occured: ${error}`))
client.on("shardResume", () => console.log("Shard resumed connection"))```I added all this in
#

Oh you said to do that

#

ok lul

lusty quest
#

disconnect is V11 shardDisconnect is V12

golden condor
#

(it's eris)

lusty quest
#

ohh. then IDK if the new one is correct

golden condor
#

It has both apparently

lusty quest
#

but you can add the set timeout and the login to the one that works

#

if you shard the bot i guess shardDisconnect is better

golden condor
#

I will try both

lusty quest
#

ok

golden condor
#

See if it works

#

Eris uses shards as a default thing anyways

#

The error event returns the error + the shard id

#

Thanks for your help, I asked in the Discord API server and no one would help, they would just tell me what I already told them and basically ignore me

lusty quest
#

d.js V12 uses ShardDisconnect as default now too

#

ok

golden condor
#

Ty

long yew
#

can anyone help? ```js
case 'search':

  let woolooEmbed = new Discord.MessageEmbed()
    .setColor(`RANDOM`)
    .setTitle('A wild wooloo spawned!')
    .setDescription(`Try catch wooloo.`)
    .setImage('https://imgur.com/oGqz0Wd.png')

  let nickitEmbed = new Discord.MessageEmbed()
    .setColor(`RANDOM`)
    .setTitle('A wild nickit spawned!')
    .setDescription(`Try catch nickit.`)
    .setImage('https://imgur.com/GjX0hfx.png')

  let blipbugEmbed = new Discord.MessageEmbed()
    .setColor(`RANDOM`)
    .setTitle('A wild blipbug spawned!')
    .setDescription(`Try catch blipbug.`)
    .setImage('https://imgur.com/ANKaMxc.png')


  let rookideeEmbed = new Discord.MessageEmbed()
    .setColor(`RANDOM`)
    .setTitle('A wild rookidee spawned!')
    .setDescription(`Try catch rookidee.`)
    .setImage('https://imgur.com/NARWgBE.png')

  let skwovetEmbed = new Discord.MessageEmbed()
    .setColor(`RANDOM`)
    .setTitle('A wild skwovet spawned!')
    .setDescription(`Try catch skwovet.`)
    .setImage('https://imgur.com/FupP7mL.png')

}
})

those pokemon are able to be found when they write .search in the route 1 place
#

can anyone help me with that?

lusty quest
#
 switch ('search') {
        case 'route1': {```try this
quartz kindle
#

you need to give switch some variable

royal tree
quartz kindle
#

show full error

lusty quest
#

sure its in the correct folder

#

its possible that you need ../server.js instead

royal tree
quartz kindle
#

do you have a server.js file? show your casetofon folder

royal tree
quartz kindle
#

you dont even have a server.js file

earnest phoenix
#

good morning everyone, hope everyone is okay. just wondered if anyone could give me some help on this. when using eval for sharding i seem to be running into a syntax error [unexpected identifier] thanks in advice for your help.

client.shard.broadcastEval(`const guild = this.guilds.cache.get('${args[0]}');
                                    if (guild) {
                                        const guildOwner = guild.members.cache.get(guild.ownerID);
                                        guildOwner.send('You Have Been Blacklisted For Violating Our ToS https://projectbump.xyz/ToS :warning: Please Join Our Support Server To Appeal! https://discord.gg/SrEUJ4z');
                                        guild.name;
                                    }
                                    else { false; }`)
      .then((results) => {
        if (results.find(r => r !== false)) {```
royal tree
#

I forgot about server.js

#

lmao

long yew
#
 switch ('search') {
        case 'route1': {```try this

@lusty quest u made that for me?

opaque oxide
#

Oi

long yew
#

ty

lusty quest
#

@long yew yes but its not completly correct

long yew
#

i'll try it

#

ok

opaque oxide
#

Tim tu fala português né?

lusty quest
#

in switch you need a array with the possible cases iirc

long yew
#

i don't understand how do add that route 1 thing fully

quartz kindle
#

@earnest phoenix idk about unexpected identifier because broadcastEval is weird version of eval. but in your code, guild owners are not guaranteed to be cached, so you would need to fetch it or you risk getting a cannot send of undefined error. also try to explicitly return guild.name instead of leaving it in the open, and you dont need the else block, just check for undefined instead

#

@opaque oxide sim

lusty quest
#

@long yew case is where your current case search is

long yew
#

that is my search case so far

#

idk how the route 1 thing works

lusty quest
#
switch ('search') {
        case 'route1': {

      let woolooEmbed = new Discord.MessageEmbed()
        .setColor(`RANDOM`)
        .setTitle('A wild wooloo spawned!')
        .setDescription(`Try catch wooloo.`)
        .setImage('https://imgur.com/oGqz0Wd.png')

      let nickitEmbed = new Discord.MessageEmbed()
        .setColor(`RANDOM`)
        .setTitle('A wild nickit spawned!')
        .setDescription(`Try catch nickit.`)
        .setImage('https://imgur.com/GjX0hfx.png')

      let blipbugEmbed = new Discord.MessageEmbed()
        .setColor(`RANDOM`)
        .setTitle('A wild blipbug spawned!')
        .setDescription(`Try catch blipbug.`)
        .setImage('https://imgur.com/ANKaMxc.png')


      let rookideeEmbed = new Discord.MessageEmbed()
        .setColor(`RANDOM`)
        .setTitle('A wild rookidee spawned!')
        .setDescription(`Try catch rookidee.`)
        .setImage('https://imgur.com/NARWgBE.png')

      let skwovetEmbed = new Discord.MessageEmbed()
        .setColor(`RANDOM`)
        .setTitle('A wild skwovet spawned!')
        .setDescription(`Try catch skwovet.`)
        .setImage('https://imgur.com/FupP7mL.png')

  }
})

quartz kindle
#

@long yew how do you want your command to work? like this? !search route1?

lusty quest
#

something like this (there are missing brackets at the end)

opaque oxide
#

Então tim

lusty quest
#

@quartz kindle yes he want to get this

opaque oxide
#

Por algum motivo meu bot só funciona com a permisão administrador

quartz kindle
#

in that case, you need to switch the args

opaque oxide
#

Isso e um problema?

#

Nem o help funciona

long yew
#

maybe

#

actually yeah

quartz kindle
#

ie ```js
switch(command) {
case "search": {
switch(args[1]) {
case "route1": {}
}
}
}

#

assuming he has args defined

opaque oxide
#

Só funciona quando eu ativo o administrador

long yew
#

i do

#

ie ```js
switch(command) {
case "search": {
switch(args[1]) {
case "route1": {}
}
}
}

@quartz kindle so that will work?

quartz kindle
#

thats just an example

opaque oxide
#

Isso e um problema @quartz kindle ???

long yew
#

ok thanks

quartz kindle
#

not for you to copy and paste

long yew
#

ik

quartz kindle
#

@opaque oxide sim, bots nao deveriam ter admin perms

#

é uma vulnerabilidade e um risco

opaque oxide
#

O xenom tem essa perm +-+

tight meadow
earnest phoenix
#

not discord.py related but the staff in python are braindead and cant help

tight meadow
#

node index.js

quartz kindle
#

se o bot for hackeado, ele pode destruir seu server, banir tudo e deletar tudo

opaque oxide
#

Mais já que só funciona com a perm administrador

tight meadow
#

try it

#

q

opaque oxide
#

Será que funciona???

#

N

tight meadow
#

funciona oq

opaque oxide
#

Pois n tem commandos desse tipo

#

O único commando de Moderação

#

Por enquanto

#

E kick

quartz kindle
#

nao é uma questao de comandos, se ele for hackeado o hacker pode criar os comandos que quiser, a unica proteção é as perms

#

anyway i guess this channel should be english only

tight meadow
#

Sim sim

quartz kindle
tight meadow
#

ingles

opaque oxide
#

Mais será que eles abre 1 ecesão

#

E que o aplicativo que eu uso para criar meus bot

tight meadow
#

ecesão

#

👏

opaque oxide
#

Eu tô com sono!!!!!

tight meadow
#

eu tb!!!!!!!!

opaque oxide
#

Essesão

#

Feliz?

tight meadow
#

Excesção

quartz kindle
#

still wrong lmao

opaque oxide
#

Acho que isso aí tá errado +-+

tight meadow
#

wot

#

Como que está errado

#

exceção

quartz kindle
#

Exceção ou Excepção em portugal

tight meadow
#

Exceção

#

Nossa eu botei um s ali

opaque oxide
#

Eu escrevi errado minha vida toda +-+

#

Tmb so tenho 12 anos +-+

quartz kindle
#

Lol

tight meadow
#

Não é que você tem 12 anos que tu fala errado

#

ele envia uma embed com os comandos na pasta

opaque oxide
#

Oque e embed

#

???

tight meadow
#

isso

opaque oxide
#

Isso oque?

#

Mensagem no privado???

tight meadow
#

no

#

embed é isso

opaque oxide
#

Ata

#

E um texto com uma linha com cor ao lado?

tight meadow
#

Bem

#

quase isso

opaque oxide
#

Ata

tight meadow
opaque oxide
#

Eu não paro de usar isso kkkkkkkkkk

#

Pera ses fica usando linguagem Java????

tight meadow
#

?

opaque oxide
#

Eu uso dbdscript

#

+-+

tight meadow
#

dbd

#

Discord Bot designer

opaque oxide
#

Sim

#

Exato

#

:)

tight meadow
#

é mais facil fazer com ele certeza

opaque oxide
#

Eu sei

tight meadow
#

eu vi o meu amigo fazendo uma embed

#

era tipo

#

$color 0x999

#

só isso

opaque oxide
#

N assim não

#

+-+

tight meadow
#

e tipo

opaque oxide
#

O meu n e assim n

tight meadow
#

o texto e outrass coisas

#

Comando de help

#

ainda bugado dele

opaque oxide
tight meadow
#

tipo

#

$dm

#

ai é ez rapaix

dusk sphinx
#

I see how it effect to work it moving

quartz kindle
#

what

dusk sphinx
#

Is that attact to discord bot command

opaque oxide
#

O ruim só DVD e que

tight meadow
#

DVD

#

wt

opaque oxide
#

Não dá para fazer bot de musica

pure lion
#

I'm so confused rn

opaque oxide
#

Dbd

pure lion
#

Uh

opaque oxide
tight meadow
#

Aqui pode

#

bad words?

pure lion
#

@quartz kindle can you quick.db?

quartz kindle
#

i dont use quick.db

pure lion
#

Foc

quartz kindle
#

but its docs are easy to understand

dusk sphinx
#

Is there any can do about {( cmd )} ?

pure lion
#

Not for me apparently

quartz kindle
#

@dusk sphinx i dont understand anything you're saying

dusk sphinx
#

I am in another lvl that you don't meet

tight meadow
#

Is ThErE aNy CaN dO aBoUt {(cdm)}

#

i

#

i don't understand

dusk sphinx
#

What command do the discord bot online

quartz kindle
#

lmao

tight meadow
#

Discod bot online

pure lion
#

Omv

earnest phoenix
#

we don't support bot makers

#

mainly because you don't have direct control over the code

pure lion
#

Cry do you know how to quick.db

opaque oxide
#

O utheo

earnest phoenix
#

if you have an issue with a bot maker app, go complain to the app developer

tight meadow
#

Oi

earnest phoenix
#

i do not dice

opaque oxide
#

Demora quanto tempo demora para os cara vê meu bot???

tight meadow
#

Como assim

dusk sphinx
#

Is any instruction for the cmd..

#

I quite forget

quartz kindle
#

@pure lion just post your question, quick.db is easy enough that people can understand it without using it

pure lion
#

Okay

tight meadow
#

command

quartz kindle
#

@opaque oxide 2-3 semanas

long yew
#
let woolooEmbed = new Discord.MessageEmbed()
        .setColor(`RANDOM`)
        .setTitle('A wild wooloo spawned!')
        .setDescription(`Try catch wooloo.`)
        .setImage('https://imgur.com/oGqz0Wd.png')

      let nickitEmbed = new Discord.MessageEmbed()
        .setColor(`RANDOM`)
        .setTitle('A wild nickit spawned!')
        .setDescription(`Try catch nickit.`)
        .setImage('https://imgur.com/GjX0hfx.png')

      let blipbugEmbed = new Discord.MessageEmbed()
        .setColor(`RANDOM`)
        .setTitle('A wild blipbug spawned!')
        .setDescription(`Try catch blipbug.`)
        .setImage('https://imgur.com/ANKaMxc.png')
``` for e.g these are some pokemon that will spawn, how do i make it so that there is a percentage chance that one will spawn?
tight meadow
#

@quartz kindle de onde

dusk sphinx
#

The trigger cmd of prefix

tight meadow
quartz kindle
#

s

opaque oxide
#

Aqui

#

Bot awaiting approval - Please

tight meadow
#

@opaque oxide Onde tu hospeda o bot

opaque oxide
#

Disseram isso +-+

#

Cliquei em app

#

Adicionei meu bot

tight meadow
#

app

opaque oxide
#

Api

tight meadow
#

API?

#

ah

honest perch
#

what is happening here

opaque oxide
#

Api

#

Adicionei meu bot

quartz kindle
#

a br invasion

opaque oxide
#

Agora tem que verificar né??

tight meadow
#

@honest perch We're

#

speaking portuguese

honest perch
#

@quartz kindle ok ill leave you to it (;

tight meadow
#

@opaque oxide Alguma hora eles vão ver

quartz kindle
#

no pls

tight meadow
#

só espera

quartz kindle
#

dont leave me alone with them

tight meadow
#

tipo

honest perch
#

haha

tight meadow
#

Tem muito bot pode levar umas semanas

honest perch
tight meadow
quartz kindle
#

@long yew you will need some math

dusk sphinx
#

Haha

long yew
#

ok i am good at math xD but what is like the code?

#

or the main thing i need

tight meadow
#

A menina botou node /.server.js

#

sem ter server.js

#

e sim index

quartz kindle
#

for example if(Math.random() > 0.1) this has a 10% chance of working

#

Math.random() returns a random decimal number between 0 and 1

long yew
#

oooooooooooooooooooo

#

wow

tight meadow
#

Quero fazer comandos de diversão

long yew
#

that is cool

tight meadow
#

antes quero fazer um uptime

#

@opaque oxide ou

#

Qual é o seu bot?

opaque oxide
#

Oi

#

Foxy

#

:)

tight meadow
#

e bota num server como ele

#

com*

opaque oxide
#

Ok

earnest phoenix
long yew
#

lol

opaque oxide
#

Utheo

tight meadow
#

sim?

opaque oxide
#

O server suporte dele tá em construção

long yew
#

simp

opaque oxide
#

Então

#

Vou te colocar

#

Num que ele ta

tight meadow
#

@long yew No no no

#

not simp

opaque oxide
#

Mandei no seu pv

long yew
#

lol

#

@long yew No no no
@tight meadow yes simp

#

lol

honest perch
spare goblet
#

You have been told multiple times by server members to follow the rules

lusty quest
#

did someone know here what parameter i need to add to a query in MongoDB to get every Document where the set Timestamp is older as the provided one in the query

digital ibex
#

u wot

lusty quest
#

i want to get every Document from a MongoDB that is older than the Timestamp i query. Every Document in the DB also got a Timestamp from the Creation

digital ibex
#

in every collection?

lusty quest
#

only one

long yew
#

is this correct?

#
if(Math.random() > 0.15)message.channel.send(woolooEmbed)
        else if(Math.random() > 0.05)message.channel.send(nickitEmbed)
        else if(Math.random() > 0.15)message.channel.send(blipbugEmbed)
        else if(Math.random() > 0.2)message.channel.send(rookideeEmbed)
        else if(Math.random() > 0.25)message.channel.send(skwovetEmbed)
        else if(Math.random() > 0.1)message.channel.send(caterpieEmbed)
        else if(Math.random() > 0.05)message.channel.send(hoothootEmbed)
        else if(Math.random() > 0.05)message.channel.send(grubbinEmbed)
bitter sundial
#

actually its possible none of them get sent

quartz kindle
#

actually yes

long yew
#

oh

quartz kindle
#

lmao

bitter sundial
#

because you're getting a new random number every if

quartz kindle
#

actually it would work

#

because he probably doesnt want to send on every single message

#

nvm what i said

earnest phoenix
#

allocation heaven

#

imagine how much memory goes on that single command

long yew
#

i am new to that command

#

thing

quartz kindle
#

a whole few bytes

golden condor
#

Declare a variable that is Math.random and check it against that variable

earnest phoenix
#

they're also creating embeds

dusk sphinx
#

Same

earnest phoenix
#

on every command

#

and only one of them is going to be used lol

dusk sphinx
#

I try to create new command that no one tried b4

golden condor
#

Declare a variable that is Math.random() and check it against that variable

lusty quest
#

would make a function to generate the random number. additional set a percentage for every item. then check if the generated number is in the range of the percentage it should spawn

dusk sphinx
#

Is [] use able for command

pure lion
#

In what context

long yew
#

Declare a variable that is Math.random and check it against that variable
@golden condor idk how

dusk sphinx
#

This [sauce]

warm marsh
#

this[variable]?

#

If so, That depends on how you setup commands.

pure lion
#

How do I find a specific value inside of an array, like a guild ID? (DJs)

dusk sphinx
#

Is is symbol also work in command

warm marsh
#

Elucidate?

#

Dice, use <array>.find

pure lion
#

can it find a string tho?

warm marsh
#

Yes.

pure lion
#

TypeError: 710964023117479966 is not a function

warm marsh
#
<array>.find((entry) => entry === "thisstring")```
#

Will either find it or return undefined.

pure lion
#

ok

#

what do i replace entry with?

warm marsh
#

Idk.

#

You choose, It's just a placeholder parameter.

pure lion
#

oh okay

dusk sphinx
#

O..um...parameter is for number right

tulip ledge
#

what? No lol

warm marsh
#

No?

tulip ledge
#

Parameters are things you pass in a function

warm marsh
#

No.

#

That's arguments.

#

Parameters are what the function asks for.

#

iirc

tulip ledge
#

Yeah thats what I ment lol

#

I mix them up alot lol

#
function name(parameter1, parameter2) {
    //code
}
dusk sphinx
#

Just triggered the cmd but..is it use 2 of symbol each to up

tulip ledge
#

what

warm marsh
#

😕

pure lion
#
TypeError: Cannot read property 'find' of undefined
warm marsh
#

Is your array actually an array?

pure lion
#

yes

dusk sphinx
#

O

pure lion
#

var arr = [array]

dusk sphinx
#

Oof

#

Haha

tulip ledge
#

arr is undefined tho

pure lion
#

(placeholder)

dusk sphinx
#

No arr in there idk why

warm marsh
#

Wherever you're trying to access this array it isn't accessible to the .find function.

dusk sphinx
#

What key do i need to make the bot online

warm marsh
#

Key?

dusk sphinx
#

Symbol key

warm marsh
#

Why are you using Symbol keys?

dusk sphinx
#

Then

#

Is that for after this $

long yew
#
if(Math.random() > 0.15)message.channel.send(woolooEmbed)
        else if(Math.random() > 0.05)message.channel.send(nickitEmbed)
        else if(Math.random() > 0.15)message.channel.send(blipbugEmbed)
        else if(Math.random() > 0.2)message.channel.send(rookideeEmbed)
        else if(Math.random() > 0.25)message.channel.send(skwovetEmbed)
        else if(Math.random() > 0.1)message.channel.send(caterpieEmbed)
        else if(Math.random() > 0.05)message.channel.send(hoothootEmbed)
        else if(Math.random() > 0.05)message.channel.send(grubbinEmbed)
``` someone help me fix this
warm marsh
#

em

#

You randomly generate a number each time?

long yew
#

how do i make this work?

warm marsh
#

Idk.

digital ibex
#

use switch

#

using that is slow

warm marsh
#

No.

#

Switch is the slower way of doing the same thing.

long yew
#

i wanna make it so there is a percentage chance of one spawning when someone writes .search

digital ibex
#

no, usnig switch just skips to whatever value because o the break;

warm marsh
#

Maybe you should store Math.random into a variable.

golden condor
#

That's what I said

digital ibex
#

whereas if checks everything and doesn't skip

warm marsh
#

Switch is programmatically slower because of how it's compiled into computer code.

golden condor
#

But it would be less cluttered

pure lion
#

im suffering

warm marsh
#

It looks nicer fair.

warm marsh
#

Switch is only more efficient if the amount of provided cases are low.

golden condor
#

I am looking for a good package/API to use for my bot as it keeps getting rate limited with yt-search. Would I get less rate limits if I used lavalink search or another API/package?

warm marsh
#

But even still, The difference between using if else and switch with a low amount of cases/statements is not noticeable.

#

Lavalink can still get ratelimited but pretty sure it web scrapes.

dusk sphinx
#

I need help..

#

It said unexpected

warm marsh
#

unexpected what?

dusk sphinx
#

Token

earnest phoenix
#

you have a syntax error

#

check if you properly closed every closure

dusk sphinx
#

I did

#

What am i missing

warm marsh
#

A missing }) or something.

#

Or even just a missing } or )

#

Either one.

dusk sphinx
#

The front or the back for those

warm marsh
#

Just click on all your brackets and see what ones don't have a sensible pair.

#

Although depending on what editor you're using it should just show a red squiggly line somewhere.

golden condor
#

@warm marsh so would lavalink be better?

dusk sphinx
#

Do i need put if for that

tame zinc
#

😋

warm marsh
#

It's got a bit of setting up but imo it's better, Not once have I been rate limited from it. Touch wood.

golden condor
#

Ok

dire stag
#

hello

#

i have succeded in running the bot online

#

but discord.js told me this First, make sure to close the process in your console. You can do so by pressing Ctrl + C inside the console. Go back to your code editor and add the following piece of code above the client.login() line.

#

and i did, so neither does the bot appear online or store messages in console

digital ibex
#

hi, with css or bulma, does anyone know how i can make the table be longer?

strange zealot
#

@dire stag try to run the code again like you did at the start

#

By exiting out of cmd and then retrying your code since you already closed it from running. There shouldn’t be a 2 terminal issue

dire stag
#

i havent retried

#

what are the codes to run it back online?

unique nimbus
#

@digital ibex change the width

digital ibex
#

o ok

dire stag
#

its back up

#

but wont log messages to console

unique nimbus
dire stag
#

wont log messages tro console

#

never mind it does

strange zealot
#

👍👍

spare goblet
#

@dire stag b careful if ur trying to log all messages to console :') its against tos to log or store anything more than required when utilising api or sdk

dire stag
#

???

#

oh yes

#

like IP?

spare goblet
#

no

#

if you're logging all messages

#

it's against tos

#

because of privacy

golden condor
#

Logging messages won't really do much unelss you are watching the logs 24/7 or are storing them. Plus discord can't find out if you log message content.

spare goblet
#

read developer guidelines

dire stag
#

ok well ı dont really need to

golden condor
#

if you're logging all messages
@spare goblet what does that mean in terms of things like snipe commands

dire stag
#

so ı wıll probably remove ıt

#

and wıll do can you lınk ıt:

spare goblet
#

@golden condor except ur technically breaking TOS

dire stag
#

whats snıpe commands?

spare goblet
#

snipe is a feature

#

if you're logging every single message for literaly no reason

#

that's against TOS

golden condor
#

Fair point

dire stag
#

but whats sniping?

golden condor
#

Like when someone deletes a message you can see it

dire stag
#

whats a good point in why you should log all messages

spare goblet
#

2.4 End User Data. “End User Data” means all data associated with the content within the functionality enabled by the API or SDK, including but not limited to message content, message metadata, voice data and voice metadata. You acknowledge and agree that Discord and its end users, as applicable, retain all worldwide right, title and interest in and to the End User Data. If you have access to End User Data through the API or the SDK, you shall ensure that your Applications do not collect, use and/or disclose End User Data except (a) as necessary to exercise your rights under this Agreement,

dire stag
#

well bots do that

spare goblet
#

**If you have access to End User Data through the API or the SDK, you shall ensure that your Applications do not collect, use and/or disclose End User Data except (a) as necessary to exercise your rights under this Agreement, **

#

collect includes both logging and storing

golden condor
#

whats a good point in why you should log all messages
@dire stag there isn't many I can think of off the top of my head

spare goblet
#

if it's outside of your necessary features then

golden condor
#

So a snipe command would be okay?

dire stag
#

ındeed

golden condor
#

For example

dire stag
#

ı wıll porbably remove ıt

spare goblet
#

a snipe command is fine beceause its only for one message

golden condor
#

Ok

dire stag
#

wh<ts a snıpe command?

golden condor
#

When my bot restarts I clear all snipes anyways

#

@dire stag seeing a message after it's been deleted

dire stag
#

i mean bots log snipes too

#

if deleted

#

and if not whats the point anyways

earnest phoenix
#

how can i delete msg via id

#

Where i can find free uptimer

digital ibex
#

hi, i have this: html <% commands.forEach((command) => { %> <%- include('guild/custom-commands', { command }) -%> <% }) %> in ejs, does anyone know why its doing this:

#

?

#

this is all my html: ```html
<body>
command
</body>

golden condor
#

because you put command

#

and did a forEach with that

#

so

delicate shore
#
        if (!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("You don't have permission!");
        const deleteCount = parseInt(args[0], 10);

        let embed = new Discord.RichEmbed()
            .setDescription("Purge")
            .setColor("RANDOM")
            .addField("**Messages: **", `**${deleteCount}**`)
            .addField("**Purged By**", `**<@${message.author.id}> with ID ${message.author.id}**`)
            .addField("**Purged In**", message.channel)
            .addField("**Time**", message.createdAt );

        if (!deleteCount || deleteCount < 2 || deleteCount > 100) {
            message.channel.send("Example: " + prefix + "purge 10");
            message.channel.send("Please enter a number between 2 and 100");
            return;
        }

        const fetched = await message.channel.fetchMessages({ limit: deleteCount });
        message.channel
            .bulkDelete(fetched)
            .catch(error => message.reply("Error. Contact an administrator."));
    }```
#

what is wrong here?

#

i know i have to change message to msg

golden condor
#

what is the error

delicate shore
#

except that?

digital ibex
#

yeah, but im not doing anything with the ejs

#

like nto yet anyways

golden condor
#

So the code inside guild/commands .ejs is command?

#

that'll be why it is repeating command

digital ibex
#

theres nothing interacting with the ejs code

earnest phoenix
#

Ping me if u knw

golden condor
#

<string>.trim()

earnest phoenix
#

anything in trim()?

golden condor
#

noper

#

that is the function that gets rid of unnecessary whitespaces

delicate shore
#

this is error

earnest phoenix
#

i dont need that

golden condor
#

define botConfigs

earnest phoenix
delicate shore
#

how

earnest phoenix
#

roles

delicate shore
#

do i define that

earnest phoenix
#

trim

golden condor
#

you just posted that

#

wdym by trm

delicate shore
#

umm?

modest maple
#

ah yes

golden condor
#

do i define that
@delicate shore you tell me, it's your code

modest maple
#

another user of glitch

#

bot gonna go by by soon

delicate shore
#

yes

#

ss

golden condor
#

I just had a brain fuck

tight plinth
#

@delicate shore dont use copy pasted code plz

golden condor
#

someone pls help me here

delicate shore
#

another user of glitch
@modest maple I have glitch premiun

earnest phoenix
#

reduce the string from 100 roles to 5 roles

lusty quest
#
Data.findOne({ timestamp: {"$gt": time} });
``` Does this give me the document where timestamp < Date.now() (mongodb)?
delicate shore
#

premum

earnest phoenix
#

how i do that

modest maple
#

I have glitch premiun
Bruh why

#

Its overprices af

#

and fucking shit

delicate shore
#

10$/month

#

not bad

winter basalt
#

shoulda get a vps but you do you

golden condor
#
Data.findOne({ timestamp: {"$gt": time} });
``` Does this give me the document where timestamp < Date.now() (mongodb)?

@lusty quest what is time defined as

modest maple
#

yes bad

lusty quest
#

its litteraly Date.Now()

modest maple
#

I could get a 6 core, 16GB ram server for that amount lol

golden condor
#

Oh then yeah

lusty quest
#

i pass it just there

golden condor
#

It should

#

iirc

#

are you using mongodb or mongoose?

lusty quest
#

mongoose

delicate shore
#

wait

#

i have no idea

#

on how to shift bot

#

from glitch

#

to mongoose

golden condor
modest maple
#

😩

#

mongoose isnt a host

golden condor
#

mongoose isn't---

#

I give up

delicate shore
#

VPS

tight plinth
#

@delicate shore just learn how to use js smh

lusty quest
#

mongoose is a client for accessing MongoDB

golden condor
#

Yes it should in that case

delicate shore
#

so how do we host bot on MongoDB?

golden condor
#

I just read the docs

#

so it should

tight plinth
#

U dont

winter basalt
#

man this guy

lusty quest
#

if you want a VPS recomendtation get a 5$ Droplet from Digitalocean

delicate shore
#

ok?

golden condor
#

But if u want all of them, put .find instead

delicate shore
#

i have never used VPS

#

Stop Bullying me

golden condor
#

Adding onto that, you can get contabo

tight plinth
#

Mongodb is a database glitch is a host

golden condor
#

or ovh

delicate shore
#

ohhhhhhhhhhhhhhhhhhhhhhhhhhhhh

golden condor
#

mongoose is a mongodb orm

delicate shore
#

But like if i buy VPS then?

delicate shore
#

how to use that

#

for hosting

golden condor
#

smh

delicate shore
#

VPS is a virtual computer

golden condor
#

@lusty quest do you want all of the documents or just one?

delicate shore
#

thing

still merlin
#

I'm making a purge command and I'm not sure how to check if the delete count is over 200, How Do i check?

lusty quest
#

hmmmm ```
DB timestamp: 2020-06-26T07:16:42.000+00:00
Date.now(): 1593174706598 -> MongoDB should convert it to the correct timestamp

golden condor
#

if (number > other number)

#

huh

#

Remind me what time format that is again (I forgot the name)

long yew
#

can anyone help me?

lusty quest
#

i just want to get one document where the timestamp is older than Date.now()

#

@golden condor unix timestamp

golden condor
#

ok

long yew
#
let arr = [1, 2, 3, 4, 5, 6, 7, 8]

      function random_pokemon(arr) {

        arr[Math.floor(Math.random() * arr.length)];

      }


      if (random_pokemon(arr) == 1) {
        message.channel.send(woolooEmbed)
      } else if (random_pokemon(arr) == 2) {
        message.channel.send(nickitEmbed)
      } else if (random_pokemon(arr) == 3) {
        message.channel.send(blipbugEmbed)
      } else if (random_pokemon(arr) == 4) {
        message.channel.send(rookideeEmbed)
      } else if (random_pokemon(arr) == 5) {
        message.channel.send(skwovetEmbed)
      } else if (random_pokemon(arr) == 6) {
        message.channel.send(caterpieEmbed)
      } else if (random_pokemon(arr) == 7) {
        message.channel.send(hoothootEmbed)
      } else if (random_pokemon(arr) == 8) {
        message.channel.send(grubbinEmbed)
      }
    }
  })
``` what is wrong with this?
still merlin
#

So
if(deletecount > 100) return message.channel('err message')?

golden condor
#

I looked on so

#

I found this

warm marsh
#

wtf

lusty quest
#

discordapi only allows 100 at max iirc

warm marsh
#

Just store each embed in the array

still merlin
#

o

warm marsh
#

then use the random to access the embed

golden condor
#

parseInt((Date.now() / 1000).toFixed(0)) @lusty quest

#

oh wait no

#

nvm

lusty quest
#

why did you convert a Date to a number?

earnest phoenix
#

So i was working on a canvas, but how can i get the time to be exact, just like .setTimestamp() does on an embed?

golden condor
#

nvm

#

Try Date.now

#

Nope

delicate shore
#

guys

golden condor
#

new Date(Date.now())

delicate shore
#

how to use MongoDB

earnest phoenix
#

@golden condor that does not work

golden condor
#

No

#

Not talking to u sorry

long yew
#

can anyone help me?

golden condor
#

Oh ok I am stupid

#

Sorry

warm marsh
#

To get the time it was sent you can use new Date().toLocaleString().split(/\, /)[1]

golden condor
#

new Date(Date.now()).getTime() will return a unix timestamp @lusty quest (also how will a document be made after you peform the action)

lusty quest
#

usually MongoDB should convert Date.now() to what you send me

long yew
#

HALP

#

me

#

pls

#

someone

warm marsh
#

You don't provide nothing for us to help you.

long yew
#

i did

golden condor
#

Just try feed in the unix timestamp maybe

warm marsh
#

All you state is that it doesn't work.

long yew
#
let arr = [1, 2, 3, 4, 5, 6, 7, 8]

      function random_pokemon(arr) {

        arr[Math.floor(Math.random() * arr.length)];

      }


      if (random_pokemon(arr) == 1) {
        message.channel.send(woolooEmbed)
      } else if (random_pokemon(arr) == 2) {
        message.channel.send(nickitEmbed)
      } else if (random_pokemon(arr) == 3) {
        message.channel.send(blipbugEmbed)
      } else if (random_pokemon(arr) == 4) {
        message.channel.send(rookideeEmbed)
      } else if (random_pokemon(arr) == 5) {
        message.channel.send(skwovetEmbed)
      } else if (random_pokemon(arr) == 6) {
        message.channel.send(caterpieEmbed)
      } else if (random_pokemon(arr) == 7) {
        message.channel.send(hoothootEmbed)
      } else if (random_pokemon(arr) == 8) {
        message.channel.send(grubbinEmbed)
      }
    }
  })
``` what is wrong with this?

@long yew

#

i get no error

warm marsh
#

Then you're not executing it correctly.

lusty quest
#

if you send Date.Now() you get 2020-06-26T07:16:42.000+00:00 bcs mongodb converts unix timestamps

warm marsh
#

Also you're missing a return in the function.

golden condor
#

Oh

#

What I don't understand is how a document will be made after you send a request

long yew
#

what do i need to add or change?

warm marsh
#

Add a return

#
      function random_pokemon(arr) {
        return arr[Math.floor(Math.random() * arr.length)];
      }
earnest phoenix
#

@warm marsh that thing you said
Date().toLocaleString().split(/\, /)[1] returns undefined

lusty quest
#

thats simple. when i create the Document i set the Timestamp + xDays. then i have a event running every 5 minutes that checks if a timestamp is older than Date.now().

golden condor
#

it's new Date

#

Oh I see