#development

1 messages ยท Page 911 of 1

neat ingot
#

you can bid for when people search specific tags

#

for example 'rpg' is one i intend to bid on once i update my bot fully to discord v 12 ๐Ÿ™‚

earnest phoenix
#

mine is utility

#

utility doesnt go for to much

green kestrel
#

i dont really even have a tag that suits my bot

earnest phoenix
#

lol really

green kestrel
#

except perhaps 'fun', all bots should be fun right?

#

ive listed before under fun and social, both worked ok

earnest phoenix
#

i must of been on trending new bots gained 440 servers and now its gone completely silent no one has added it

neat ingot
#

be thankful you got so many imo

#

when iw as trending i went from liek 7-> 60 servers

green kestrel
#

i got tons last year, its slowed down now

neat ingot
#

im only upto 80 now, and its been like 2-3 months since i was featured ๐Ÿ˜„

green kestrel
#

im pushing for 2k

earnest phoenix
#

i am so grateful im not saying im not

neat ingot
#

oohh nice, gz!

#

nah i get it dood, obviously you want to keep growing ๐Ÿ™‚

#

whats your bot do?

earnest phoenix
#

im just curious what happened lol

#

mines just a partner bot

green kestrel
#

mines a learning chat bot with the ability for server owners to add their own javascript

neat ingot
#

๐Ÿ˜ฎ

toxic jolt
#

Hi

neat ingot
#

how do they add their own code? how do you validate that their code isnt hacky?

toxic jolt
green kestrel
#

yeah, its sandboxed in a system that even limits how much cpu time per request

toxic jolt
#

what should i write

earnest phoenix
#

write what data you store and how did you secure your systems, like it says lol

green kestrel
#

i use a javascript interpreter embedded inside a C++ bot, so theres no "client.token" and not even a client object to query, it has its own simple api within the js

neat ingot
#

"i store all the data on a napkin by my bedside table"

toxic jolt
#

I using glitch lol

earnest phoenix
#

oh god

#

@toxic jolt thats your verification request

neat ingot
#

oohhh nice one brain

earnest phoenix
#

just write what it says

#

you gotta answer it on your own

toxic jolt
#

okay.

neat ingot
#

btw, @green kestrel, you should use the brain from lil dickys image as your avatar imo ๐Ÿ˜„

toxic jolt
#

Omg its so hard

earnest phoenix
#

its not

#

that's what she said

green kestrel
green kestrel
#

lol, not pinky and the brain?

earnest phoenix
#

filled mine out a few days ago playing the waiting game now lol

green kestrel
#

thats where my nick comes from, pinky and the brain

neat ingot
#

you know, off topic af. but there is a fan theory that 'the brain' was the one who was insane, and pinky was the genius, because he was able to constantly foil brains world domination plans. ๐Ÿ™‚

green kestrel
#

i always thought that was obvious rather than a fan theory ๐Ÿ˜„

earnest phoenix
#

brain so there's like no exploits like managing to read memory and breaking out of the sandbox?

#

you can tell the difference between homepage and not now lol

#

or accessing stdlib apis

toxic jolt
#
  1. What specific Discord data do you store? ** | What does he mean here? I don't have much English sad**
green kestrel
#

@earnest phoenix none that any have found yet, i was careful. youre limited in terms of cpu, ram, and even how complex regexes can be, as well as number of messages sent, amount and size and time for web requests

earnest phoenix
#

@toxic jolt exactly what it says lol, what do you store from discord

green kestrel
neat ingot
#

so you programmed a custom js interpreter then?

green kestrel
#

no, i embedded one called duktape thats pretty much modern js compatible

#

instead of V8

earnest phoenix
#

smart

neat ingot
#

ahhh, interesting ๐Ÿ˜„

green kestrel
#

its much more lightweight, with duktape i can support thousands of scripts on my dedicated server at once, with node and V8 i'd struggle to support 50

toxic jolt
#

@toxic jolt exactly what it says lol, what do you store from discord
@earnest phoenix hmm, message.author.id , guild.id ? Should I write them?

earnest phoenix
#

yes

toxic jolt
#

Okay thanks

green kestrel
#

the source codes on github for my bot if youre interested ๐Ÿ™‚

earnest phoenix
#
//do something

setInterval (interval => function () {
if(active !== "active") return clearInterval(interval)
}, 1)

//do something
}, defined); ```

Why doesn't work this?
cinder patio
#

server maintenance read announcements

neat ingot
#

already looking at it brain ๐Ÿ˜„

earnest phoenix
#

it's smart to put strict limitations on it, i've seen people break out of "sandboxed" evals by just accessing the kernel api and reading memory of other processes lol

green kestrel
#

you want modules/js/js.cpp if you want to see how it does the javascript

earnest phoenix
#

oops i didnt even see announcements lol

green kestrel
#

ah, i dont have a kernel api or even filesystem access, it only has the functions i explicitly code into it ๐Ÿ™‚

earnest phoenix
green kestrel
#

those and any javascript builtins

earnest phoenix
#

how can you even make a channel follow like that

neat ingot
#

man this is some next level sht

#

how long you been coding this bot?

green kestrel
#

since october

neat ingot
#

...

green kestrel
#

but i gave coding on it a break since feb, as ive been working on a game

earnest phoenix
#

that's a news channel @earnest phoenix

green kestrel
#

had to come back to coding it to fix some bugs, and make users happy, and also to support intents ๐Ÿ™‚

neat ingot
#

wow, way to make me question my entire lifes work

#

๐Ÿ˜„

green kestrel
#

but: the bot is based on a previous bot for IRC

earnest phoenix
#

iirc only partnered/verified and guilds from people with the dev license thingy have it

green kestrel
#

just to make you feel better, that bot is 18 years old

earnest phoenix
#

thats so trash

green kestrel
#

all that one did was learn stuff, he knows 8 million responses

earnest phoenix
#

i want a follow channel

#

news

neat ingot
#

lmao

green kestrel
#

you can get a news channel with enough boosts too iirc btw @earnest phoenix

trail rain
#

I have issue i don't know how to fix it, when i change bot volume to 50 for example it will change to 50 in every servers... Anyone can help >_<

green kestrel
neat ingot
#

i mean, you have basically coded a custom javascript discord api in c++ thats only usable within your bot ๐Ÿ˜„

earnest phoenix
#

zynb, i unfortunately donated my crystal ball to healthcare workers to help fight covid-19 so you'll have to give us a bit more details

#

how do you get news channels lol you gotta be a partner or something

#

yes

#

or buy the dev license thing

slender thistle
#

Buy a developer license catshrug

earnest phoenix
#

oh

#

i dont think id benefit from that anyway lol

toxic jolt
#

How have you secured access to your systems and infrastructure? | what did that mean help @earnest phoenix

earnest phoenix
#

what securities do you have to prevent people from breaking into your server and database

toxic jolt
#

Hmm.

earnest phoenix
#

oh god

mossy vine
#

what security should i have omegalul

earnest phoenix
#

considering you're using glitch probably none lol

#

@toxic jolt You gotta answer them on your own spoonfeed

ember atlas
#

@toxic jolt @earnest phoenix lets keep the off-topic emotes in #memes-and-media as this is for development help.

#

Same for you @rich hazel

earnest phoenix
#

Sorry m

#

so you know trending new bots im 5th with 92 votes i have more votes than 1st how comes its 5th haha

#

am i missing something

#

like how does it work

neat ingot
#

yusss. i totally got away with it all ๐Ÿ˜„

modest maple
#

you go down every day pretty much

#

you only stay trending for about a week if that

neat ingot
#

i was there for like a day and a bit ๐Ÿ’”

modest maple
#

i was there for about a week and a half

#

xD

neat ingot
#

lucky ๐Ÿ˜„

earnest phoenix
#

i was gaining bout 150 servers a day when it first got approved now its quiet lol

neat ingot
#

tbh i wish my got was getting approved now

#

so many more potential users with the corona lockdowns

earnest phoenix
#

approved on what top gg

neat ingot
#

yea, cause then i'd be on trending while there are like 5x more people using the site

earnest phoenix
#

im on trending i was getting loads id wake up and have like 50 added servers

#

woke up today didnt have any

scenic nest
#

how to make command that if i triggering it that will send random message

restive furnace
#
let array = ["random", "message", "you", "can", "place", "here", "many", "things", "u want"]

let msg = array[Math.floor(Math.random() * 10)]

//then send the msg to channel with random msg``` example in js
neat ingot
#

create an array of the random responses, and randomly choose one.

scenic nest
#

ok

#

not sending any

earnest phoenix
#
Function: bot.on("message", async message => {
await sleep(zz);

I want to wait for sleep() but it says error: "SyntaxError: await is only valid in async function"?

restive furnace
#

await is only on async function

#
<client>.on("event", async (event, arguments) => {
    console.log("event emitted");
});```
earnest phoenix
#

u cant change it

thin jacinth
#

Seems so

earnest phoenix
#

ye

thin jacinth
#

I tired

#

like

earnest phoenix
#

nice

thin jacinth
#

<body style="background-color: #2f3136;">

#

It changes the main bg

earnest phoenix
#

oh

thin jacinth
earnest phoenix
#

xD

thin jacinth
#

But it doesn't work for content

zenith terrace
earnest phoenix
#

wait let me see in the website

zenith terrace
#

try it with that ?

thin jacinth
#

kk

zenith terrace
#

<div class="content">

earnest phoenix
#

try this

#

div.longdescription

#

<div class="longdescription">

#

div.longdescription
{
background-color:black;
}

thin jacinth
#

e

earnest phoenix
#

wut

#

show me ur code

thin jacinth
#

this?

div.longdescription
<div class="longdescription">
div.longdescription
{
 background-color:black;
}
earnest phoenix
#

only
div.longdescription
{
background-color:black;
}

thin jacinth
#

yep

earnest phoenix
#

mhm

thin jacinth
#

We got zebra

earnest phoenix
zenith terrace
earnest phoenix
#

so .longdescription .content

#

Query for : "Cannot send messages to this user"?

#

nah ncm

#

nvm

thin jacinth
#

Oh I almost solved it using margins

earnest phoenix
#

how ?

zenith terrace
#

border-color dont even wanna show up

thin jacinth
zenith terrace
#

im messing around and trying shit

earnest phoenix
#

border:10px fill black

#

?

#

@zenith terrace cuz there are no boder

thin jacinth
earnest phoenix
#

so make ur width longer

thin jacinth
#

yep

earnest phoenix
#

or add some padding

neat ingot
#
#bot-details-page #details .container {
    border-bottom: 1px solid #18191c;
    border-top: 1px solid #18191c00;
    padding: 40px 0;
}```
#

yw ๐Ÿ˜—

earnest phoenix
#

oh

#

oh it was solid not fill

zenith terrace
earnest phoenix
#

i have made a mistake

unique nimbus
#

me to myself

earnest phoenix
#

no the border is not longer then 1px

#

u see there are no border:1px

zenith terrace
#

boder

neat ingot
#

omfg it finished!

#

yea... that really wasnt worth the 3 hour wait time.
note to others: dont bother using waifu2x to upscale videos.

earnest phoenix
#

@zenith terrace ?

unique nimbus
#

@neat ingot It depends on the quality, 360p to 720p

#

is much better than 720p to 1080p

neat ingot
#

i went from 360p -> 1440p ๐Ÿ˜„

#

tbf, it worked

zenith terrace
#

@earnest phoenix boi ๐Ÿ˜‚

neat ingot
#

just not worth the wait time for an ep of south park i already seen ๐Ÿ˜„

unique nimbus
#

ah

#

lmao

#

I mean

#

Its neat

zenith terrace
#

boder

earnest phoenix
#

?

#

?

#

photoshop

neat ingot
#

yea, for sure its pretty neat. but the time it takes it just obscene ๐Ÿ˜„

zenith terrace
#

bruh

#

lmao

earnest phoenix
#

lmao

robust moth
zenith terrace
#

No defined

robust moth
#

I don't understand !!

cinder patio
#

Error: ENOENT: no such file or directory, open 'path\node_modules\canvas\build\config.gypi' anyone ever gotten such an error when trying to install node-canvas? I updated my node version to latest but that broke tons of things so reverted and now I'm getting this

neat ingot
#

yes

#

umm

#

sec, i wrote down how i fixed it

#

I legit cant find it now wth, im gonna need that again as well lmao

#

there was a thing i had to make sure my environment had

#

do you use npm or yarn?

cinder patio
#

npm

neat ingot
#

in my dockerfile i use yarn, i feel like it was to resolve that issue

#

yarn install --production

#

rebuilds the things from source or something

#

im sure np will have a similar feature

cinder patio
#

Also I get different errors too:

 fatal error C1083: Cannot open compiler generated file: \node_modules\canvas\build\Release\
obj\canvas\BMPParser.obj Permission denied
fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory
#

everytime it's different

neat ingot
#

what is the machine bots running on?

cinder patio
#

Windows 10 64bit

neat ingot
#

ahh, mine was a docker container which runs super minimal linux i beleive

cinder patio
#

oof, this is really annoying

neat ingot
#

oh, apparently the production flag is only to ignore devdevependancies wth

#

npm install --build-from-resource

cinder patio
#

fatal error C1083: Cannot open compiler generated file: 'path\node_modules\canvas\build\Release\obj\canvas\BMPParser.obj': Permission denied [path\node_modules\canvas\build\canvas.vcxproj]

neat ingot
#

๐Ÿ‘€

#

never seen that one i dont think

cinder patio
#

I have other packages that require node-gyp and they get installed just fine

#

So I am not sure it's really a permission error

neat ingot
#

yea, i had tons of issues with canvas when i moved to docker containers

#

which canvas version?

#

"canvas": "^2.6.1", is what im using atm

cinder patio
#

yeah this one

#

This is happening cause I installed node v. 14.1.0 to try the latest features, had to rebuild canvas, rebuilding did not work, so I just switched back to my previous version (12.16.3)

neat ingot
#

what version is your node-pre-gyp?

#

ooohhh node 14 already huh

cinder patio
#

v0.13.0

neat ingot
#

theres me just udpated to 12 lol

#

is from my yarn file

#

seems to be using v11

cinder patio
#

I have to go rn but later I'll try to downgrade node-pre-gyp and I'll ping you with updates. Thanks

neat ingot
#

np dude, gl! ๐Ÿ™‚

sacred mountain
#

Hi. Im trying to update a database (with quick.db) and then send the data in that database whenever the command is run but for some reason it sends the old data from the last time i ran it... im trying to do db.set() and i might be doing something wrong...

hollow prawn
#
setInterval(() => {
   snekfetch.post(`https://discordbots.org/api/bots/${bot.user.id}/stats`)
    .set('Authorization', 'DBLtoken')
     .send({ server_count: bot.guilds.size })
    .then(() => console.log('Updated stats.'))
     .catch(err => console.error(`Whoops something went wrong: ${err.body}`));
}, 3600000)```
does this work for updating top.gg stats?
earnest phoenix
neat ingot
#

๐Ÿ˜„

sacred mountain
#

Hi. Im trying to update a database (with quick.db) and then send the data in that database whenever the command is run but for some reason it sends the old data from the last time i ran it... im trying to do db.set() and i might be doing something wrong...

cosmic girder
#

quick question how do u make a cooldown for a command

placid crown
#

adding on to that, is there anyway to make a cooldown for a specific user for a command?

#

@cosmic girder my idea would be use the time.time() function to record when the command is used

#

create a variable that stores the last time the command was used successfuly

#

eaach time someone tries to use the command, check to see if the current time - the last used time is greater than some cooldown period

#

if so, run the command and updaate the value of the last_used variable

cosmic girder
#

ty

placid crown
#

np

modest maple
#

what lib

#

also for cooldowns use a bucket or somthing

thin jacinth
#

quick question how do u make a cooldown for a command
@cosmic girder which library do you use?

cosmic girder
#

@thin jacinth wdym

thin jacinth
cosmic girder
#

discord.js

knotty steeple
#

what library do u use for a bot

#

typical that its js when they dont even know a lib

thin jacinth
knotty steeple
#

depends on what the command cooldown is

#

is it a simple 5sec cooldown

#

or something like 24h

cosmic girder
#

its 2 minutes

#

thts it

knotty steeple
#

u can use a set

thin jacinth
#

@cosmic girder if you're going to store the timestamps you'd better make a dictionary to make independent cooldowns for different servers

knotty steeple
#

and some setTimeouts

cosmic girder
#

ok

thin jacinth
#

Depends on your purposes but still

knotty steeple
#

its a 2minue cooldown

#

no need

thin jacinth
#
{
    guild_id: {
        member_id_1: timestamp,
        member_id_2: timestamp
    }
}
knotty steeple
#

again thats not needed in this case

thin jacinth
#

Kk

knotty steeple
#

if its a 1h cooldown

#

ehh

thin jacinth
#

I didn't read the dialogue above, my bad

knotty steeple
#

but more than 2h i would store in a db

thin jacinth
#

Yeah in case the bot shuts down

turbid bough
#

If your bot shuts down, the server will probably be offline for enough time to not matter much for 2 minutes

knotty steeple
#

pretty good

ivory pebble
#

Yeah

knotty steeple
#

idk if this is the right place u would ask tho

ivory pebble
#

Make the buttons bigger though

knotty steeple
pallid marsh
#
msg.channel.awaitMessages(() => true,{ max: 1})
.then(collected=>{
console.log(collected)
})``` hey, im trying to await for messages in a channel, thats my code but nothing happens in the console after i write a message... any help?
knotty steeple
#

dont think its complete

#

check the docs

pallid marsh
#
const quiz = require('./quiz.json');
const item = quiz[Math.floor(Math.random() * quiz.length)];
const filter = response => {
    return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};

message.channel.send(item.question).then(() => {
    message.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ['time'] })
        .then(collected => {
            message.channel.send(`${collected.first().author} got the correct answer!`);
        })
        .catch(collected => {
            message.channel.send('Looks like nobody got the answer this time.');
        });
});``` thats an example from docs
knotty steeple
#

so ur missing time

pallid marsh
#

do i have to put time?

knotty steeple
#

for how long to wait for a message yes

restive furnace
#

u can use a set
i prefer Map

knotty steeple
#

and the errors for time

#

so it triggers catch when it runs out of time

pallid marsh
#

same with time

crisp crown
#

@pallid marsh nerden รงaldฤฑn amk malฤฑ

summer torrent
#

@flat pelican

knotty steeple
#

a mod pls -notr

summer torrent
#

turkish slurs...

knotty steeple
#

oh lmao

#

yikes

flat pelican
#

ooo @crisp crown naber ya gรถrรผลŸemiyoruz

crisp crown
#

@flat pelican tanฤฑyamadฤฑm?

flat pelican
#

tanฤฑลŸtฤฑrayฤฑm, ben ban hammer

crisp crown
#

eee

summer torrent
#

๐Ÿ˜‚

flat pelican
#

smh

#

Why is people so big brainy

#

Anyways

summer torrent
#

-bots 288736087889805313

#

oof

wanton wasp
#

Anyway know how to use Sequelize to check all rows with X for Y?

**Example: **

//I want to check if the MatchList Database already has a user already in a match

//This finds the row we want to check. 
const CheckUser = await MatchList.findAll({ where: { GameID: args[1] } });

//This checks the GameID row's UserID and if it equals the message author's ID and if does, it says you're already in the game/match. 
if (CheckUser.UserID === message.author.id){return message.reply("You're )}

This seems like it should work in theory but the MatchList.findAll does not check all of the rows with the same GameID, only the first row with the GameID

earnest phoenix
#

Any one know how to change text coller red in discord

knotty steeple
#

where

#

oh

#

u cant change message colors

#

just the little bar on the side of embeds

earnest phoenix
#

@knotty steeple

#

Seen bro

#

This type

copper cradle
#

dude

knotty steeple
#

thats a codeblock

copper cradle
#

that page

#

literally tells you hoe

#

and those are codeblocks

knotty steeple
#

they want red it seems

#
- thing
#

is this red

earnest phoenix
#

How to bro

#

Red

copper cradle
#

they literally ignored us

knotty steeple
#

use diff for the language instead of bash or whatever

#

if its even red

mossy vine
#

that page tells you how just open your eyes and fucking read

knotty steeple
#

u cant see codeblock colors on mobile

earnest phoenix
#

Seen

mossy vine
#

it doesnt work on mobile bro

earnest phoenix
#

Oo

knotty steeple
#

but cyber ur on desktop right

#

does it actually work

earnest phoenix
#

Ok

#

Ok

#

Bro

mossy vine
knotty steeple
#

cool

copper cradle
#

this guy doesn't fucking read

wanton wasp
#

Anyway know how to use Sequelize to check all rows with X for Y?

**Example: **

//I want to check if the MatchList Database already has a user already in a match

//This finds the row we want to check. 
const CheckUser = await MatchList.findAll({ where: { GameID: args[1] } });

//This checks the GameID row's UserID and if it equals the message author's ID and if does, it says you're already in the game/match. 
if (CheckUser.UserID === message.author.id){return message.reply("You're )}

This seems like it should work in theory but the MatchList.findAll does not check all of the rows with the same GameID, only the first row with the GameID

tardy estuary
#

speaking of changing colors, my bot randomly selects a color from all available embed colors when replying

#

i thought that was kewl, mostly because the embed color is so tiny that it doesnt give a good enough indication for the responding message

copper cradle
#

and use nested for loops

#

one for x and one for y

#
for (let i = 0; i < rows.x; i++) {
  for (let j = 0; j < rows.y; j++) {
    // do crap with the j and i cords
  }
}
#

don't ask me where you can get the rows object bc this is pseudo code

thin jacinth
#

I have one problem to deal with
My bot organizes kind of Clan Wars on discord servers
I store every clan in my DB but every time someone wants to edit a clan, he has to provide the exact clan name as a command argument which is not cool
So I decided to add "searching system" but there are 2 ways to make it

  1. Load all clans linked to the server where the command was used and let author to provide a number of the clan he is looking for
  2. Load only names, perform search and load the matching clan from DB after the author choice
#

1st way cons are:
-> A lot of memory is going to be used while performing search
2nd way cons are:
-> 2 DB requests in a row, which slows down the process

tardy estuary
#

2 database requests shouldnt slow anything down. but you added an additional action which technically "slows down" the process to begin editing a clan. I don't see that as a bad thing though

#

I think it makes sense to load all clan names, and ask the requestor to input their choice, and then load that specific clan.

topaz fjord
#

method 1 seems better

#

but it depends on how you are storing the clans

tardy estuary
#

how do the clan editing permissions work?

#

im assuming edit permissions are restricted, and you have that info stored as well? And can one clan leader have multiple clans? If not, you could just check if they are a clan leader and instantly load their respective clan. If they can have X clans, you could then load X number of clans they are associated to. It might reduce the amount of memory used

turbid bough
tardy estuary
#

hey thats like my job at work, except im refactoring the poor code others wrote.

turbid bough
#

oh wait, right yeah it does nvm im dumb

earnest phoenix
#

@wanton wasp you can also findAll() then filter that array with a game id that matches args[1]
that should return an array of what you want

turbid bough
#

imma be so happy when everything i do stops working

#

the more changes i do, the more anxious i feel about breaking it all

sudden geyser
#

Is that C#?

turbid bough
#

yes

#

and i feel like its 100% gonna not work

cinder patio
#

@neat ingot Same error :L "Error: ENOENT: no such file or directory, open projectDir\node_modules\canvas\build\config.gypi"

earnest phoenix
unique nimbus
#

You mean an embed

pallid marsh
#

how can i get the role of my bot in discord.js?

#

in a guild

unique nimbus
#

guild.role?

earnest phoenix
#

yes

unique nimbus
#

I don't know js

pallid marsh
#

message.guild.roles.client?

earnest phoenix
unique nimbus
#

You would be on mobile

earnest phoenix
#

to my bot

pallid marsh
#

u cant

unique nimbus
#

Apparently you can

pallid marsh
#

rlly?

copper cradle
#

you can

earnest phoenix
copper cradle
#

but like

#

you can read the docs

unique nimbus
#

yes

copper cradle
#

if you know how to read

#

ofc

lost kettle
#

verify is not a function what is this?

knotty steeple
#

u can set ur bot status as mobile yes

copper cradle
#

bc apparently a lot of ppl don't read

earnest phoenix
#

Can anyone help me how do I make this wall of the bot available by asking an answer

#

i dont know how to read ||xd||

knotty steeple
#

@lost kettle read

unique nimbus
#

@earnest phoenix What Client you using, discord.js, discord.py?

#

etc

earnest phoenix
#

yes

#

js

copper cradle
#

@lost kettle wdym

#

Asks a non yes or no question

unique nimbus
#

It is called an embed

copper cradle
#

their answer: yes

unique nimbus
#

Have a look

lost kettle
#

yes

#

but is not working

unique nimbus
knotty steeple
#

i prefer the embed object

#

when sending

unique nimbus
#

I just looked at the docs

#

and found this

#

I haven't worked on discord.js bot for ages

#

like 5 months

#

so

#

ยฏ_(ใƒ„)_/ยฏ

knotty steeple
#

nah thats easier for noobies

#

but its an extra require :)

unique nimbus
#

Go link the docs

#

for it

knotty steeple
#

for what

unique nimbus
#

For embed object

knotty steeple
#

look at the send function

#

its an option

earnest phoenix
#

This is not what I am looking for @unique nimbus

pale vessel
#

maybe he meant perms

unique nimbus
#

oh

slender thistle
#

Very vague question

copper cradle
#

they don't even know what they're looking for lmao

knotty steeple
#

Can anyone help me how do I make this wall of the bot available by asking an answer
the fuck does this even mean

copper cradle
#

that's some next level engrish

pale vessel
#

but wall = embed mmLol

white gyro
#

Probably google translated

tardy estuary
#

asking an answer

#

wew

turbid bough
#

its all gone now

#

no more errors, i bet ill find a ton of bugs

earnest phoenix
#

How do I give my bot mobile presence? (Discord.js)

pale vessel
#

ws options

earnest phoenix
#

That's not helping

#

Explain

knotty steeple
#

it is

#

look at the docs for websocket options

white gyro
#

You can't, they're fooling you

knotty steeple
earnest phoenix
#

You can

cinder patio
#

client.options.ws.properties.$browser = "Discord iOS";
set this before you login

pale vessel
#

you can lmao

unique nimbus
#

Don't spoonfeed

pale vessel
#

don't be ignorant

cinder patio
#

That's not easy to find, it's not documented at all

white gyro
#

If it's not documented, they don't support it

pale vessel
#

they do

#

it works ok

glass sandal
#

I am trying to integrate so you can mention the bot for commands or still just run the prefix I am using this if (message.content.startsWith(prefix)) { and can not seem to get anything to work

knotty steeple
#

what is prefix

glass sandal
#

guild.prefix which fetches the DB for the guilds prefix

#

It is just saying command not found

blazing portal
#

well then show more code

glass sandal
#
            if (message.author.bot) return;
            if (!message.content.startsWith(prefix));
            if (!message.member) message.member = message.guild.fecthMember(message);
            if (message.channel.type === "dm")return;
            const args = message.content.slice(prefix.length).split(/ +/);
            const cmd = args.shift().toLowerCase();

            const Mention = message.mentions.users.first()
            if (message.content.startsWith(prefix) || Mention) {
                let permissions = message.channel.permissionsFor(client.user);
                let command = client.commands.get(cmd);
                let aliases = client.aliases.get(cmd);
                if (permissions.has("MANAGE_MESSAGES")) {
                    message.delete()
                }
                if (!command) {
                let embed = new MessageEmbed()
                embed.setColor("#00FFFF")
                embed.setFooter(`Infinity Bot was made by Cam & IceyyM8`)
                embed.setTitle('Error')
                embed.setThumbnail(client.user.displayAvatarURL())
                embed.setDescription(`That command was not found, try ${prefix}help`)
                return message.channel.send(embed).then(w => setTimeout(() => { w.delete() }, 5000));
                }```
pale vessel
#

you didn't even return

blazing portal
#

3rd row yeah

rich goblet
#

how can i edit my page like this

blazing portal
#

become Verified @rich goblet

#

on DBL, not Discord

rich goblet
#

oh :/ okay

blazing portal
#

Certified*

rich goblet
#

okay i understood

knotty steeple
#

thats wrong

modest maple
#

use css

knotty steeple
#

if u want to customize ur page use css

rich goblet
#

okay i will try

#

i did thx

sinful belfry
#

hey, does anyone know if there is a way to add message content (so i can @mention someone and they get pinged) to a message that also contains an embed? using discord.js v12

modest maple
#

there should be

cinder patio
#

channel.send("CONTENT", {embed: someEmbed}) afaik

modest maple
#

endpoint allows content and embed content so should do

sinful belfry
#

ok thanks, i will try it out

#

awesome, it all works

#

thanks for the help

robust moth
knotty steeple
#

read the error

sudden geyser
#

What is client.db?

robust moth
#

Client.db is data file

sudden geyser
#

As in can you show where you declared it

#

That's not what client.db exactly is.

robust moth
#

client.db = new sqlite3.Database("./data/public/guildinfo.sqlite");

sudden geyser
#

db.get takes a callback. The first argument is the error (if one occurred) and the second one is your data if any was found.

knotty steeple
#

also thats odd

#

row names with spaces

sudden geyser
#

If you want to use promises, use the sqlite npm package.

knotty steeple
#

if u want something better use better-sqlite3

robust moth
#

Ok

tardy estuary
#

bad practice to use spaces in table and column names

#

use underscores

knotty steeple
#

or camelCase

#

smh

robust moth
#

Ok .. any documentation for sqlite

sudden geyser
tardy estuary
#

i typically use underscores because at a past job oracle db would have a tendency to automatically uppercase object names

#

do whatever you want, but avoid spaces. it causes weirdness to happen

sudden geyser
#

try it out and see

robust moth
#

Yeap perfectly run

restive furnace
sudden geyser
#

too much work

thin jacinth
#

im assuming edit permissions are restricted, and you have that info stored as well? And can one clan leader have multiple clans? If not, you could just check if they are a clan leader and instantly load their respective clan. If they can have X clans, you could then load X number of clans they are associated to. It might reduce the amount of memory used
@tardy estuary thing is that administration can also edit clans

#

2 database requests shouldnt slow anything down. but you added an additional action which technically "slows down" the process to begin editing a clan. I don't see that as a bad thing though
@tardy estuary yeah I came to this decision in enother community
Thanks for participating

tardy estuary
#

i guess in that case if admins were editing it would create higher memory usage, but if that is an a-typical use case, I think going from most common to least common use case (which would cause increasing memory usage) would be reasonable as well.
AKA automatically load the clan if permissions AND only one clan. Otherwise load all of the associated clans and prompt. Worst case scenario would be for admins, best case scenario would be single user with only one clan.

simple stump
#

How would I sense whether ANY message is sent? I'm creating a "leveling" system and want to check whether an user sent a message.
Ex.

if (user_sends_message) {
  energy+1
}

I'm using Node.js by the way.

tardy estuary
#

so you just want to know how to detect a message event?

simple stump
#

yes.

#

i saw the documentation but it was a bit confusing

tardy estuary
#

thats a pretty basic feature

#

in fact its how anything really works

simple stump
#

yes ive tried:

client.on('message', message=> {
});
#
client.on('message', message=> {
    if (message) {
        let rawdata = fs.readFileSync('./energy.json');
        let energyF = JSON.parse(rawdata);
        var user = message.member.id;
        var add = energyF;
        add[user] = {
            energy: 2 + (energyF[user]!=null && energyF[user]["energy"] != null ? energyF[user]["energy"] : 0)
        }
    }
})

Sorry prob should have sent some code

#

i'm using json files for tracking the exp

#

but it doesn't seem to be working

#

the numbers next to the member id dont go up; they're just static atm.

earnest phoenix
#

i mean are you saving the json afterwards?

#

like i dont know js, but that might be the issue

simple stump
#

yes. im saving it

#

i used a simple !addenergy cmd and it worked

sudden geyser
#

that's not saving

simple stump
#

so now im trying to actually add the exp for every msg

sudden geyser
#

you need to save it within that block of code

tardy estuary
#

are you replacing the user in the json every time?

sudden geyser
#

though I'd avoid using json as a database

simple stump
#

oh heck

#

yeah i forgot

#

lol. my bad

opaque seal
#

Guys how would you copy, let's say, only the VIEW_CHANNEL permissions from a voice channel to another?

tardy estuary
#

yeah I would utilize a regular db, sqlite perhaps

simple stump
#

and kinolite yes ive thought about using a db. i hvae experience in mysql but i was brainstorming sme ideas and thought it would get quite complex afterwards

#

cause i have to insert the data, update it every single time an uesr talks, and it might start lagging behind a little bit

#

i might upgrade to a db in the future

marble juniper
#

you can also use quick.db

simple stump
#

but considering its a small bot in a community server i dont rlly want to use it yet

#

link maybe

#

but id prefer using mysql. its something im familiar with

marble juniper
#

quick.db may not be the best and stuff and there are probably better things

#

but its easy to use

simple stump
#

and itd be gud to get some experience in json lol. i might use it in the future

elder garnet
#

how do i PM a specific user using discordjs?

simple stump
#

hmm. i might look into it

#

@elder garnet i believe message.author.send

elder garnet
#

specific

marble juniper
#

u get the user object

#

then

sudden geyser
#

remember that at any time you write your data could become corrupted. with an actual db it's less likely

marble juniper
#

send

elder garnet
#

okay

tardy estuary
#

the problem is with that json file is you are reading a single file from disk

marble juniper
#

just do client.users.cache.get

#

and then id

lost kettle
#

hi i have a question

marble juniper
#

then you have the object

simple stump
#

kinolite yes. i know the possibility of it getting corrupted. hopefully this wont happen which is why i made a !backup cmd xD

tardy estuary
#

you cannot write to it simultaneously, if that happens

marble juniper
#

only works if the user is cached ofc

sudden geyser
#

We may have an answer, Liberius.

lost kettle
#

I made a ping command. But it doesn't work. NaNms writes

tardy estuary
#

unless you have your commands coming through synchronously, you could save a previous state

sudden geyser
#

show code

marble juniper
#

code show

lost kettle
#

okay but there are turkish words in the code so don't be surprised :d

marble juniper
#

ok

#

just send it

lost kettle
#

const Discord = require('discord.js');

exports.run = async (client, message, args,) => {
const useruser = "Komut " + message.author.username + " tarafฤฑndan รงalฤฑลŸtฤฑrฤฑldฤฑ";
const userurl = message.author.avatarURL;
const bayrak = "๐Ÿ‡น๐Ÿ‡ท";
const ping = ${Math.round(client.ping)}ms;

let embed = new Discord.MessageEmbed()
.setTitle('๐Ÿ›ก๏ธ Anlฤฑk Gecikme Sรผresi ๐Ÿ›ก๏ธ')
.setColor("#00FF00")
.addField("Ping :", ping)
.addField("Lokasyon :", bayrak)
.setFooter(useruser, userurl)
.setTimestamp();

message.channel.send(embed);

}

exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 0
};

exports.help = {
name: 'ping',
description: 'Gecikme sรผresini gรถsterir.',
usage: 'ping'
};

marble juniper
#

what version of discord.js

lost kettle
#

i dont now

simple stump
#

How would I assign a role to an user for a certain period of time? Ex. tempmute command.

pale vessel
#

store timestamp in db

sudden geyser
#

Liberius you're using v12.

#

client.ping is not a thing I believe.

#

I believe it's client.ws.ping

simple stump
#

Okay thx flazepe.

marble juniper
#

client.ping doesn't work

#

since client.ping aint a thing

#

and client.ws.ping is the websocket ping

pale vessel
#

it would work on v11

sudden geyser
#

also avatarURL in v12 is now a function.

marble juniper
#

would

#

but we are talking about v12

pale vessel
#

yes

marble juniper
pale vessel
#

because you said it wasn't a thing

marble juniper
#

it isn't one anymore

pale vessel
#

ye

marble juniper
#

in the newer ones

pale vessel
#

ig

lost kettle
#

hm

opaque seal
#

Guys how would you copy, let's say, only the VIEW_CHANNEL permissions from a voice channel to another?
anyone knows?

marble juniper
#

I don't know what you mean by that with copy a permission

#

to a voice channel

#

like what

lost kettle
#

I believe it's client.ws.ping
@sudden geyser THANKS BRO ฤฐTS WORKฤฐNG

pale vessel
#

read docs next time

#

not that hard

lost kettle
#

thank you all

marble juniper
#

was about to say

opaque seal
#

I don't know what you mean by that with copy a permission
I want to create a channel with the same permissions as another one, but only certain permissions not all

marble juniper
#

but im slow af

sudden geyser
#

yeah np

#

but that's websocket ping

#

not the ping of how long it took to send the message.

marble juniper
#

yea

#

you can do that by making a new date object then editing the message and then making a date object again

#

and then just minus

lost kettle
#

okey

marble juniper
#

I would have sent a code with it but im on mobile so

pale vessel
#

good thing you're on mobile

lost kettle
#

Okey

#

so client.ping is now client.ws.ping?

pale vessel
#

yes

lost kettle
#

thanks

lusty quest
#

is it possible to store the messageid from an embed you create in the same command?

neon lava
#

@acoustic mural lan bende tรผrkรผm sen insanlarฤฑ kฤฑz taklidiyle kandฤฑrmaya mฤฑ รงalฤฑลŸฤฑyon lan

earnest phoenix
lost rover
#

its not even related to development

lost kettle
#

Has the await verify command changed?

knotty steeple
#

whats an await verify command

lost kettle
#

command not working

knotty steeple
#

can u try to make more sense

lost kettle
#

ok wait

#

const verification = await verify(message.channel, opponent) this is a command

When he writes yes or no he gives an error when he needs to answer

quartz kindle
#

what is verify? this is not standard code, are you using a module/package?

lost kettle
#

discord.js

quartz kindle
#

there is no verify in discord.js

#

verify is a custom function you made, or someone made for you, or you copied from somewhere

turbid bough
#

are you sure you didnt copy from anywhere?

quartz kindle
#

if it worked in v11 but doesnt work in v12, then you have to modify the function to work in v12

#

we need to see how the function works to be able to help

lost kettle
#

It works in v11 or v10.

#

I received this command from my friend

#

a long command duel command

quartz kindle
#

what is the error?

lost kettle
#

error

#

wait

#

TypeError: verify is not a function

quartz kindle
#

that doesnt help

#

show your full code

earnest phoenix
#

how do i delete the user command after the bot performs the command ONConfusedPikachu

quartz kindle
#

in discord.js?

#

message.delete()

earnest phoenix
#

yep

#

hmm i was doing this message.delete().catch(O_o=>{}); it deletes and gives an error

quartz kindle
#

what error?

earnest phoenix
#

just a big one but it works

#

should i just do message.delete()

lost kettle
#

(node:163) UnhandledPromiseRejectionWarning: TypeError: verify is not a function12:02 AM

Jump Toat Object.exports.run (/app/komutlar/dรผello.js:19:44)
(commands)/(duel.js)

this is error.

And Command:

const verification = await verify(message.channel, opponent);
if (!verification) {
this.fighting.delete(message.channel.id);
return message.channel.send('write');....

quartz kindle
#

@earnest phoenix show error

earnest phoenix
#

one sec

quartz kindle
#

@lost kettle show full code

lost kettle
#

Duel command?

quartz kindle
#

yes

lost kettle
#

There are Turkish words in the command. so the words the bot will answer are turkish, codes english

quartz kindle
#

its ok

earnest phoenix
#

pff took so long

glass sandal
#

So anyone know why my autorole works on my test bot but not on my main bot

earnest phoenix
#

permission maybe

quartz kindle
#

@earnest phoenix cannot send empty message

glass sandal
#

No main bot has same perms

earnest phoenix
#

yep the command i did was (*say hi) and its not an empty msg but i still get the error

quartz kindle
#

something somewhere is trying to send an empty message

glass sandal
#

I am using this ``` const guildDoc = await Config.findOne({ guildID: member.guild.id });
console.log(guildDoc)
if (!guildDoc || !guildDoc.welcomechannel) return;

if (guildDoc.autorole === null) {
    return;
}

if (guildDoc.autorole !== null) {
    member.roles.add(guildDoc.autorole)
}```
quartz kindle
#

show the full command

glass sandal
#

me?

quartz kindle
#

no, him

#

@glass sandal what version of discord.js?

glass sandal
#

V12

quartz kindle
#

can you console.log(guildDoc.autorole)?

#

see if its a proper role

earnest phoenix
#
if(command === "say") {

    const sayMessage = args.join(" ");
    
    message.delete().catch(O_o=>{}); 
  
    message.channel.send(sayMessage);
  }
woven cliff
#

i have problem with the invite manager its show me he is offline what i can do?

quartz kindle
#

this is not the support server for invite manager

#

this is the server for the website top.gg

earnest phoenix
#

u can find the support server on they website

glass sandal
#

I put the console.log in the if (guildDoc.autorole !== null) { member.roles.add(guildDoc.autorole) console.log(guildDoc.autorole) } and nothing was logged

woven cliff
#

theier invite not work

pale vessel
#

where's the mod smh

scenic kelp
#

here

#

but what can I do

pale vessel
#

wrong server

earnest phoenix
#

``bump: (msg) => {
con.query(SELECT * FROM settings WHERE guildid = ${msg.guild.id}, (err, result) => {
if (err) return console.log(err)
let cooldown = (60 * 60 * 1000)
if (result[0].premium === 1) {
cooldown = cooldown / 2
}
const now = Date.now()
const lastTimeBumped = result[0].last_time_bumped ? result[0].last_time_bumped : 0

  if (now - lastTimeBumped > cooldown) {
    con.query('SELECT * FROM settings', (err, row) => {
      if (err) return console.log(err)
      msg.guild.fetchInvites().then(invites => {
        if (row.length - 1 <= 0) {
          sendEmbed(msg, 'There are no other guilds for your advertisement to go, `p%invite` and setup the bot on other guilds before trying again.')
          return
        }
        if (invites.size > 0) {
          const invite = invites.first()

          bumpLogic(msg, row, invite)
        } else {
          let channelID
          const channels = msg.guild.channels.cache
          for (const c of channels) {
            const channelType = c[1].type
            if (channelType === 'text') {
              channelID = c[0]
              break
            }
          }

          const channel = channels.get(msg.guild.systemChannelID || channelID)
          channel.createInvite().then(invite => {
            bumpLogic(msg, row, invite)
            sendEmbed(msg, `Bumped sucessfully to **${row.length - 1}** Servers.`)
          })
        }
      })
    })
    con.query(`UPDATE settings SET last_time_bumped = NOW() WHERE guildid = ${msg.guild.id}`, (err) => {
      if (err) console.log(err)
    })
  } else {
    sendEmbed(msg, 'You must wait **** before you can use this command again.')
  }
})``

basically its a bump command that lets you bump to other servers but its meant to update database so that you have to wait 1 hr before

#

you can do it again

earnest phoenix
#

some reason i can do unlimited bumps

pale vessel
#

proper codeblock pls

glass sandal
earnest phoenix
#

@earnest phoenix ONConfusedPikachu

#

@earnest phoenix what

glass sandal
#

So it is thinking guildDoc.autorole is null and it is returning

#

which it is not

quartz kindle
#

what does the first console.log show?

#

the one that logs guildDoc

glass sandal
#

shows everything for the guild

#

prefix welcomechannel leave channel and the autotole

#

autorole which is not null

quartz kindle
#

what if you do console.log(guildDoc.autorole) there, at the beginning

glass sandal
#

Sends the role id 707692558163247205

#

note: not with ""

quartz kindle
#

put it again right after the first if

glass sandal
#

Nothing

quartz kindle
#

then there is no welcomechannel

earnest phoenix
#

anyone able to help with my issue id appreciate it

quartz kindle
#

console.log guildDoc.welcomechannel

pale vessel
#

proper codeblock pls
@pale vessel

glass sandal
#

Thanks

quartz kindle
#

@earnest phoenix console.log(sayMessage)

#

before sending

#

show what it logs

earnest phoenix
#
 },
  bump: (msg) => {
    con.query(`SELECT * FROM settings WHERE guildid = ${msg.guild.id}`, (err, result) => {
      if (err) return console.log(err)
      let cooldown = (60 * 60 * 1000)
      if (result[0].premium === 1) {
        cooldown = cooldown / 2
      }
      const now = Date.now()
      const lastTimeBumped = result[0].last_time_bumped ? result[0].last_time_bumped : 0

      if (now - lastTimeBumped > cooldown) {
        con.query('SELECT * FROM settings', (err, row) => {
          if (err) return console.log(err)
          msg.guild.fetchInvites().then(invites => {
            if (row.length - 1 <= 0) {
              sendEmbed(msg, 'There are no other guilds for your advertisement to go, `p%invite` and setup the bot on other guilds before trying again.')
              return
            }
            if (invites.size > 0) {
              const invite = invites.first()

              bumpLogic(msg, row, invite)
            } else {
              let channelID
              const channels = msg.guild.channels.cache
              for (const c of channels) {
                const channelType = c[1].type
                if (channelType === 'text') {
                  channelID = c[0]
                  break
                }
              }

              const channel = channels.get(msg.guild.systemChannelID || channelID)
              channel.createInvite().then(invite => {
                bumpLogic(msg, row, invite)
                sendEmbed(msg, `Bumped sucessfully to **${row.length - 1}** Servers.`)
              })
            }
          })
        })
        con.query(`UPDATE settings SET last_time_bumped = NOW() WHERE guildid = ${msg.guild.id}`, (err) => {
          if (err) console.log(err)
        })
      } else {
        sendEmbed(msg, 'You must wait **** before you can use this command again.')
      }
    })
  },```

@pale vessel
abstract spruce
#

how do you host a discord bot???? DM me and tell me

earnest phoenix
#

@quartz kindle you said to post here

quartz kindle
#

@earnest phoenix whats the problem with it?

#

@abstract spruce which part of hosting? how to upload it to a vps? how to code it?

earnest phoenix
#

tim basically it is not updating the database

#

so i can keep bumping

#

its meant to update the time

#

so i cant keep bumping till an hour has passed

quartz kindle
#

which database?

earnest phoenix
#

mysql database

#

Ah no worries I fix it

#

i cant seem to get it to update so it wont let me till an hour has passed

quartz kindle
#

what is the data type of the column?

earnest phoenix
#

timestamp

knotty steeple
#

btw for ur sql i wouldnt straight up just do something like WHERE guildid = ${msg.guild.id}

#

use ? then offer the guild id

#

this also works better for args

earnest phoenix
#

is my sql database settings for last time bump configured correctly as shown above

knotty steeple
#

never new NOW() was a thing

#

idk

earnest phoenix
#

what did you think it was

knotty steeple
#

i cant and dont want to read code on mobile

earnest phoenix
#

haha

#

so yeah it not updating the time i up

#

so obvs when i do p%bump its not updating the lasttimebumped table

royal portal
#

does anyone know how to make it so if this command and command then do this

knotty steeple
#

if u cant type fast do it in one message

royal portal
#

so if(command === "!help" and if(command === "-help"

amber fractal
#

using the or operator..?

knotty steeple
#

instead of doing that use some kind of prefix variable

royal portal
#

i do

#

thats an example

#

im trying to use || or something

knotty steeple
#

||

#

or

#

use this

royal portal
#
if(command === "help" || command === "halp") {
earnest phoenix
#

yeah i dont know how to get it to update the table when you do the command

knotty steeple
#

thats not how it works

quartz kindle
#

@earnest phoenix is the database actually not updating? have you console.log(lastTimeBumped) to see if you're not getting a string instead

knotty steeple
#

cuz the opening bracket after the or operator shouldnt be there

#

bruh

pale vessel
#

wrap it up

knotty steeple
#

yes

pale vessel
#

but it won't look as clean

#

oh nice it's fixed

knotty steeple
#

pls make command file loading

#

and proper command handler

#

i assume ur using 1 file

neat ingot
#

^ everyone should have this

pale vessel
#

event handler

knotty steeple
#

i also have an event handler

#

๐Ÿ˜Ž

pale vessel
#

saves quite a bit of memory

#

i do

royal portal
#
if(command === "help" || command === "halp") {

is this how?

knotty steeple
#

but i think its kinda ass

pale vessel
#

tryitandsee

knotty steeple
#

could make it shorter

#

and better

pale vessel
#

faster and stronger ay

knotty steeple
#

yes

royal portal
#

lol

late plank
#

@royal portal yes that's fine

pale vessel
#

if you use a switch you could've done case "help" case "halp":

royal portal
#

also

earnest phoenix
#

tim wheres the best place to put that log thing underneath
sendEmbed(msg, 'You must wait **** before you can use this command again.')

neat ingot
#

imo - if your bot doesnt have a command handler thats capable of loading/unloading/reloading a command - so that you dont need to reboot every time you fix a bug or add a new command - then your doing it wrong.

pale vessel
neat ingot
#

theres an example on how to have such features incase anyone wants info

earnest phoenix
#

i meant sendEmbed(msg, `Bumped sucessfully to **${row.length - 1}** Servers.`) sorry

knotty steeple
#

i load every command on boot

#

by finding the files wit fs

neat ingot
#

same

quartz kindle
#

i mean console.log(lastTimeBumped) right after you define it

knotty steeple
#

but i dont have a load command function

neat ingot
#

๐Ÿ˜ฎ

knotty steeple
#

or unload

neat ingot
#

you should get some!

#

super helpful to just do like >reload commandname

pale vessel
#

i have a reload command where it clears the collection and load every command again

knotty steeple
#

all????

#

bruh

neat ingot
pale vessel
#

and a command for reloading one command of course

knotty steeple
#

mine doesnt use a function but i do have a reload command

#

i just do some require cache deleting stuff idk

pale vessel
#

so i have reloadall and reload command

knotty steeple
#

and readd it to the collection

neat ingot
#

reloading all may as well be a reboot imo ๐Ÿ˜„

#

its much faster i guess.

pale vessel
#

no

knotty steeple
#

so i can reload a command that wasnt even loaded

pale vessel
#

it's fast

knotty steeple
#

lmao

pale vessel
#

i have 100+ commands but they reload in less than 2 seconds

earnest phoenix
#

time it came back with 2020-05-06T21:00:38.000Z

late plank
#

Your bot doesn't have 12 million commands?

pale vessel
#

no, just one million

quartz kindle
#

@earnest phoenix then thats your problem

knotty steeple
#

my 40 bot commands used to load in like close to a second

quartz kindle
#

the database is updating correctly, but you're getting the timestamp as a string from the database, so your time checking doesnt work

late plank
#

My most popular bot has ...6?

knotty steeple
#

oh yes i should add the time

#

it takes to load

amber fractal
#

imagine a very popular bot without reload, the number of shards it will have to restart

earnest phoenix
#

how would i make it check it properly then

late plank
#

@amber fractal they're out there

earnest phoenix
#

tim the entry says 9pm but its 11pm

late plank
#

My bot is in ~900 servers and it has no reload; haven't needed it yet

amber fractal
#

yeah that's still 1 shard though

late plank
#

I'm aware;

#

haven't needed it yet

amber fractal
#

I mean a fully sharded bot

knotty steeple
#

1 shard is as long as a normal boot

#

without sharding

late plank
#

@knotty steeple a bot in 2 servers will still boot faster than one in 900

#

unfortunately

knotty steeple
#

i mean the same count without sharding

late plank
#

yeah

#

I'm not very excited for when I have to shard

earnest phoenix
#

a bot in 2 servers will still boot faster than one in 900
well yes and no

#

if you choose to ignore certain events with intents then the latter will be faster

#

a lot of info is returned in the READY event

late plank
#

all I care about is message, ready, guildCreate and guildDelete

#

if there's events I have to opt-in to ignore, please let me know

earnest phoenix
#

how do i convert it so its not a string its just date and time

amber fractal
#

new Date(date string)?

neat ingot
#

i was gonna suggest that lol

quartz kindle
#

@earnest phoenix try this: SELECT UNIX_TIMESTAMP(last_time_bumped) FROM settings

pale vessel
#

why does javascript use milliseconds

neat ingot
#

that sql syntax ๐Ÿ˜„

pale vessel
#

such a pain to compare

amber fractal
#

because it's precise

#

it's unix that uses ms

quartz kindle
#

otherwise yeah, you can just new Date(rows[0].last_time_bumped).getTime()

pale vessel
#

but MySQL uses seconds right

quartz kindle
#

yes

amber fractal
#

just divide by 1000 then

#

not really difficult

pale vessel
#

yes but i'll have to do that a lot

neat ingot
#

if you have the 'moment' library then you could do
moment("2014-02-27T10:00:00").format('DD-MM-YYYY');

late plank
#

are you concerned about the speed cost of dividing by 1000

pale vessel
#

no

neat ingot
#

but thats still gonna be a string

#

just formatted however you want

knotty steeple
#

just store js timestamps

#

smh

#

or

#

unix epoch time

#

i should say

pale vessel
#

i do that lol

quartz kindle
#

yeah, you could just store timestamps as a big int, but then you lose access to mysql's native date comparison functions

pale vessel
#

i don't use that so I'm good

knotty steeple
#

i use sqlite

#

kek

neat ingot
#

mongodb/mongoose ftw โค๏ธ

quartz kindle
#

sqlite here as well

knotty steeple
#

mongoose for me was confusing

#

and i guess mongodb as a whole

grizzled raven
#

about discord.js' caching, since ```js
message.channel message.guild.channels.cache.get(message.channel.id)
client.channels.cache.get(message.channel)
//these are all the same

amber fractal
#

opposite for me, sql is confusing asf for me

pale vessel
#

how

neat ingot
#

imo mongoose allows you to work very differently to how you would woprk with raw mongodb

amber fractal
#

wym how

#

idk

pale vessel
#

sql is ez

amber fractal
#

it's just confuising

neat ingot
#

normally mongodb is schemaless. mongoose adds schemas.

quartz kindle
#

@grizzled raven they are the same yes, only their type changes

#

everything is linked by reference

#

ram is taken by the amount of instances, be it from channels, users, members, roles, voice states, emojis, presences, etc...

amber fractal
#

I just dont like sql syntax

#

I'd rather .findOne({id:"a-1274bhasd"}) than SELECT * from some_other_stuff_that_I_dont_know

pale vessel
#

fair enough

#

still like SQL though

grizzled raven
#

sql speed though

neat ingot
#

mongodb is not slow.

grizzled raven
#

idk i was planning on switching to mongo anyway

#

nah its not

amber fractal
#

I've never had speed problems with mongo

grizzled raven
#

never said it was slow

pale vessel
#

is this db wars holy shit just use whatever you're most comfortable with

grizzled raven
#

just meant to say that some sql dbs are just a bit faster

#

but i probably wont ever need to worry about speed lmao

#

not like my bot is gonna get that big anytime soon

earnest phoenix
#

where would i put new Date(rows[0].last_time_bumped).getTime() time?

#

in that code

knotty steeple
#

u can use sqlite until its like a tb for 2

#

idk

pale vessel
#

not happening anytime soon lol

earnest phoenix
#

this issue is annoying me so much ahhhh

late plank
#

@earnest phoenix you've helped me speed up my bot bootup by 75%

#

thanks

earnest phoenix
#

if someone could say where to put new Date(rows[0].last_time_bumped).getTime() in that code id really grateful lol

amber fractal
#

idek what you want though

pale vessel
#

just use timestamp like me

earnest phoenix
#

im using timestamp...

pale vessel
#

unix epoch

#

in milliseconds

#

stored in a db

earnest phoenix
#

like its logging the time its just 2 hours behind

neat ingot
#

'way more lesser' lol

knotty steeple
#

ok mongo shill

neat ingot
#

๐Ÿ˜„

pale vessel
#

at this point idgaf anymore

#

MySQL is just simple

earnest phoenix
#

...

pale vessel
#

update it with a statement

earnest phoenix
#

both are trash

#

simple for you yeah maybe

#

but for me its not as much

pale vessel
#

yeah postgres is superior

#

i know cry

earnest phoenix
#

oracle is known for making slow shitty and unoptimized products

#

mysql being one of them lol

pale vessel
#

but SQL in general

#

it's simpler than mongo

#

my opinion

neat ingot
#

each to their own ๐Ÿ™‚

earnest phoenix
#

so flaze i guess you wont help me with it

pale vessel
#

yep to each their own

#

probably not

earnest phoenix
#

id be happy if you would

pale vessel
#

good luck

earnest phoenix
#

why are you in here then lol

#

this channel is for support no?

pale vessel
#

because idk what you're trying to do tbh

neat ingot
#

to troll people asking for help ofc ๐Ÿ˜„