#development

1 messages · Page 1606 of 1

lime current
#

or maybe on 2 bot it would work

earnest phoenix
#

Yeah, if you made the application itll be the same bot

#

You just have to enter the token again.

#

indeed

#

Thats why my bot is still named the same

lime current
#

yes'

#

ok

earnest phoenix
solemn latch
earnest phoenix
#

Yup like he said

#

oh ok

lethal grail
#

nvm

#

this is what happens when i clicked add bot. luca dmed me saying success! but when i go to the bot page it brings this

unkempt ocean
lethal grail
#

oh ok, what do i do? i have already added the bot twice

solemn latch
#

wait till the issue is fixed

stark abyss
#

I am really confused on what to do. I want to make a command where the bot gives a role to just 40 people at maximum, but even so some people said its a api spam even if I pace it 5-10 secs; while others said it's okay if I pace it.

#

so is it okay for me to pace it 5-10 secs and do it for only 40 members or should I just not do it at all?

pulsar lantern
#

@stark abyss it's a bad practice for a public bot to do stuff like that where mass roles are given out as it could quickly get out of hand and spam discords API, but if you're doing it just for your own server as an experiment, it wouldn't be API spam, and if it was, discord would just give you a "You are being rate limited" message

stark abyss
#

so I would hit a rate limit even if I pace it

earnest phoenix
#

api abuse would be constantly hammering the api with no delay whatsoever

#

what you want to do is fine

swift cloak
#

how can i make a visitor counter?
if you know, ping me!!
in html

stark abyss
#

this isn't just for my server tho

earnest phoenix
pulsar lantern
#

well, the issue is if it's a public bot and it gets used by a fair amount of people, if 5 servers use that command at once the requests just pile up and up and up

swift cloak
earnest phoenix
#

still impossible

#

you need a backend

earnest phoenix
swift cloak
#

oh what

earnest phoenix
rigid shadow
swift cloak
#

javascript is backend? right?

pulsar lantern
#

global rate limit across the shard

earnest phoenix
#

well

swift cloak
#

like a whole ass backend?

earnest phoenix
#

you can use js as your backend through node.js

swift cloak
#

damn

earnest phoenix
#

but js alone is not backend

swift cloak
#

oh ye i use node.js for my other website backend

#

ok forget html

#

how can i do it?

earnest phoenix
#

in a nutshell, it's just getting the ip from the request, making sure the ip wasn't already marked as a visitor then just +1

#

you'd use a database for this so the count is there even after your app dies

#

something like sqlite

#

having a hard time with removing a user ID from a json file.

{"userid": "code"}```

```py
@bot.command()
async def unlink(ctx, userid):
    with open('config.json', 'r') as json_data:
        jsondata = json.load(json_data)

    for element in jsondata:
        element.pop(userid, None)

    with open('config.json', 'w') as data_file:
        data = json.dump(jsondata, data_file)

any idea why this wouldn't work?
Getting discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'pop'

havent really messed with json stuff that much until recently

mellow kelp
#

oh wait you meant something else

earnest phoenix
# earnest phoenix something like sqlite

if you were to use sqlite you'd just have a table and you'd structure it like this ```
+-------------+---------------------+
| ip | visit_date |
+-------------+---------------------+
| 192.168.1.1 | some unix timestamp |
| 1.1.1.1 | some unix timestamp |
| 8.8.8.8 | some unix timestamp |
| .... | some unix timestamp |
+-------------+---------------------+

#

then just COUNT the entries

#

the date is there so you can delete rows that are older than x hours/days/...

sturdy dock
#

Is it a bad idea to use con.execute() for every mysql2 query

#

Because eventually it errors out due to too many prepared statements

gilded olive
#
>>>list = [1,2,3]
>>>list
[1,2,3]
>>>list.pop[0]
>>>list
[2,3]```
#

Also why are you iterating over the json and popping strings???

#

get the actual data with ```py

jsondata["something"]```

jolly mortar
#

i have a code that changes the name of the channel and i added a cooldown to it beacuse it makes my bot super laggy after running it and i want to make it so people with perms can only run it but when i put this in my code js if (message.member && message.member.hasPermission("MANGE_CHANNELS")) { it gives me an error so i added another } at the end of my code but it doesnt respond.

earnest phoenix
gilded olive
#

Working with JSON for the first time can be challenging, take it slow if you can

earnest phoenix
#

yeah

#

it seems pretty simple if everything is predefined but like im trying to pass an argument in the command through to remove in the json list.

so like

;unlink <userid>

will remove the userid and their code from the json

#

linking was easy because its just dumping but im trying to delete a specific "key"

static trench
#

hey DBL. my D.py bot isnt responding to any commands other than mentioning it and it replying "hi" i have tried a lot of things like change prefix and so forth. can anyone help?

earnest phoenix
#

are you defining your prefix?

static trench
#

wdym?

#

there are commands

earnest phoenix
#
bot = commands.Bot(command_prefix="prefix")
static trench
#

ya

#

bot = commands.Bot(command_prefix='.'

earnest phoenix
#

)

static trench
#

oh

#

crap

#

nope its there

#

nvm

#

i didnt copy all of it

earnest phoenix
#
@bot.command()
async def ping(ctx):
  await ctx.send("Pong!")
#

try adding that and using .ping

static trench
#

ya

#

nothing

#

idk. there are no errors in the terminal

earnest phoenix
#
### ----- Logging Initialization ----- ###
logger = logging.getLogger('discord')
logger.setLevel(logging.INFO)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
#

add that so it throws errors

#

import logging at the beginning aswell

static trench
#

ok

earnest phoenix
#

if it doesnt show anything with that, change logger.setLevel(logging.INFO) to (logging.DEBUG)

static trench
#

lol

earnest phoenix
#

debug should show a console output every time it sees a new messge

static trench
#

ill try to work. i have dinner. this has never happened

earnest phoenix
#

good luck!

static trench
#

ty

vernal minnow
quartz kindle
#

you're trying to use something that requires a number, but you're not giving it a valid number

fierce ether
#
const props = new (require(`${commandPath}${path.sep}${commandName}`))(this);```
#

what am i doing wrong?

#

TypeError: require(...) is not a constructor'

lyric mountain
#

many stuff

fierce ether
#

how should it be then?

lyric mountain
#

first of all why are you using new for require?

#

actually, I got a better question

#

what is that supposed to do?

fierce ether
#

load the commands

earnest phoenix
#

anyone know a good way to pull code from my json file by looking up ctx.author.id json {"userid": "code"}

tried this, but wont work:

    with open('config.json', 'r') as cjson:
        json_file = json.load(cjson)
    traderchannelid = []

    for item in json_file:
        trader_info = {"{}".format(ctx.author.id):None}
        trader_info['trader1'] = item['trader1']
        traderchannelid.append(trader_info)
#

last thing i need to get working and of course i get stuck on it. starting to wonder if ini or yml wouldve been easier

lyric mountain
lyric mountain
#

like, get a value from json?

odd stratus
#

Can you even do “new require” in JS lol 🧐

lyric mountain
#

don't think so

summer torrent
#

yes

earnest phoenix
opal plank
odd stratus
#

thinking_2 Oh

opal plank
#

Though, i think you might be able to completely fuckify this code into something not even experienced js users would do cuz its readability is super retarded

#
const { client: (new { Client })()} = require('discord.js')
#

i THINK this may be valid

odd stratus
#

Wtf bruh

opal plank
#

yeah, you can declare destructured objects like that

odd stratus
opal plank
#

let me run a test script rq

#

i think thats valid

#

though it might bitch about it being used before its declaration

odd stratus
opal plank
#

no aparently not

#

you cant call it before it been delcared

#
const { client: { Client },} = require('discord.js');```
but this is valid
#

ACTUALLLY

#

nah you cant even call this inside there

#

@quartz kindle time for fucky code

opal plank
quartz kindle
#

wut

#

i dont think you can do any operation while destructuring

#

the same way you cant do something like this

mellow kelp
#

tim has spoken

opal plank
#

i can do in one line or in two

#

the one line i showed before

sudden geyser
crimson vapor
#

const client = new require('discord.js').Client()

mellow kelp
#

discord bot development 101

crimson vapor
#

nah

#

102

mellow kelp
#

well yea

#

101 is having a brain

manic root
#

Wrong. 103

crimson vapor
#

shit I frogot to take 101

mellow kelp
#

oh dang

manic root
#

Is 150: use ts?

mellow kelp
#

that one's probably 130 or something

blissful coral
#

In express, is there a way to have multiple GETs with one app.get()

#

For example like app.get(["/info", "/about", "/information") or something

crimson vapor
#

umm

#

what

#

ah

#

app.use

#

wait

#

yes

blissful coral
#

uh

crimson vapor
#

no

blissful coral
#

app.use?

crimson vapor
#

sec

blissful coral
#

Not app.use LMAO

crimson vapor
#

app.get('/*', (req, res, next) => {})

blissful coral
#

Ok

crimson vapor
#

wait

#

is info not static?

mellow kelp
#
function myHandler(req, res) {
  // some shit
}

app.get('route1', myHandler);
app.get('route2', myHandler);
app.get('route3', myHandler);
#

ezpz

glacial pagoda
#

If Inc Is Equal To Increase Then Is Dec Equal To Decrease? When I Put Dec it Says Unknown So What Do I Put? Its For Mongoose

#

Hello?

#

OH Would It Work if Instead Of $dec I Put !$inc?

#

@mellow kelp

#

ANYONE!?!?!??!?!?!??!?!?!?

mellow kelp
#

dude, don't ping random people

glacial pagoda
#

Sorry...

#

I Just need help

odd stratus
#

Pinging people in an aggressive manner gives you a 99% chance of not being helped

glacial pagoda
#

I Was sorry

odd stratus
#

I know

#

I'm just saying for future reference

glacial pagoda
#

ok

#

can someone help me

#

with mongoose

mellow kelp
#

you should just use $inc with a negative number

#

idk what $dec does but it definitely doesn't decrease

glacial pagoda
#

But Its Not negative

mellow kelp
#

just add a - before the number

glacial pagoda
#

so.. coins: -profileData.coins - args[0],

#

?

#

That Would give a negative output

#

so coins: -profileData.coins - -args[0],

#

Right?

#

or no

mellow kelp
#

what are you trying to do

glacial pagoda
#

Im trying to decrease the two variables

#

minus it by eachother

#

and save the output into coins

mellow kelp
#

uhh okay

#

to increase a value use $inc

glacial pagoda
#

ik

mellow kelp
#

to decrease it just input a negative number

#

done

glacial pagoda
#

hmmm

#

Im so confused on where to put it

#
         coins: profileData.coins - args[0],
         },```
#

?

mellow kelp
#

i meant set it to a negative value

glacial pagoda
#
         coins: -profileData.coins - -args[0],
         },```
#

?

mellow kelp
#
$inc: {
   coins: -Number(args[0])
}
#

this will decrease coins by the amount on args[0]

glacial pagoda
#

huh

mellow kelp
#

k?

#

okay im out

glacial pagoda
#
$inc: {
   coins: -Number(profileData.coins - args[0])
}```
#

?

#

It Looks right

#

lemme try

vagrant flare
#
    bank: Number(args[0])
    coins: -Number(args[0])
#

probably

#

thats what they are saying

glacial pagoda
#

oh

vagrant flare
#

so bank increments by the value coin decrements (coin decrements cuz its negative number)

glacial pagoda
#

Now i get it

#

Thanks

#

Ill Check Back if anything goes wrong

vagrant flare
#

i've never used mongoose, i was just trying to help explain

glacial pagoda
#

ok

vagrant flare
#

is there anyone using discord.py and has like a web_server (for dbl) set up to work asynchronously with their code

(I have already tried using aiohttp app runners, they work fine until after a few mins i get:
OSError: [WinError 64] The specified network name is no longer available)

earnest phoenix
#

How did you run the web server?

#

Welp, I don't have windows env, so this never happened. But if the webserver still runs, you can ignore the error ig think

glacial pagoda
#

What Do I Replace for has

#

find?

#

I forgot

rare trail
#

there is some docs i can read for embed pagination?

fast marsh
#

would anyone know how to get the progress bar in the rank card to reset once the user levels up? because so far when they level up, the progress bar is in center or more in the card

rare trail
fast marsh
#

i made it with discord-canvas

glacial pagoda
earnest phoenix
#

Whatever You're Calling Has On Is Undefined

#

Find Out Why

glacial pagoda
#

How Tho, Wait Lemme Get The Code

fast marsh
#

cooldowns and/or time_stamps

glacial pagoda
#

const args = message.content.slice(prefix.length).split(/ +/);
to
const command = args.shift().toLowerCase();
to
const cmd = client.commands.get(command);
to
const time_stamps = cooldowns.get(cmd.name);
to
if(time_stamps.has(message.author.id)){

#

Everything looks fine

#

but still

#

OH I DIDNT DEFINE COOLDOWNS

#

nvm i did

#

const cooldowns = new Map();

#

So then What

#

I think its the .name

copper cradle
#

by any chance, are you blind?

#

it fucking says 'x' doesn't have a 'has' property

#

time_stamps is undefined

glacial pagoda
#

ik

#

so if you go to the const time_stamps

#

.name

#

:/

odd stratus
#

cooldowns.get

What if cooldowns defined as

agile lance
#

if cooldowns.get is returning undefined, that means thats not a collection present, nor defined. try client.cooldowns.get

feral aspen
#

I keep getting this error, what does it mean? (node:22) UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.

tardy hornet
#

Is there any way to directly push the data into the json.sqlite file?

(quick.db)

earnest phoenix
#

hi guys

#

how could i check if a guild has animated icon?

#

i tried to log guild.features

#

and i get

#
[
  'COMMUNITY',
  'WELCOME_SCREEN_ENABLED',
  'NEWS',
  'ANIMATED_ICON',
  'INVITE_SPLASH'
]
#

for ex

#

how could i check if the guild has 'ANIMATED_ICON'?

feral aspen
#

Ah

#

It doesn't show me which file though, that's unfortunate.

lusty quest
#

well you can easy find it, usually you have 2 strings seperated by a ,

tardy hornet
#

Is there any way to directly push the data into the json.sqlite file?

(quick.db)

lusty quest
#

¯_(ツ)_/¯

#

probably with sqlite

#

and no layer inbetween

#

or why did you want to do this in the first place?

cursive python
median horizon
#

One question..
I use usern = self.bot.get_user(userd).display_name to get the discord username in red bot
but then if I await bank.deposit_credits(usern, money)
I get 'str' object has no attribute 'id'. What am I doing wrong?

lusty quest
#

where is userd defined?

median horizon
#

the line above

#

it's the user id as an int

lusty quest
#

dont store ids as an int

median horizon
#

I know the username is displayed properly

quartz kindle
#

you are trying to use a username as an id, this is not a good idea. if a person changes their username they lose all their money

median horizon
#

lol I load them from a file..

lusty quest
#

some languages do some funky stuff if you store the ids as a int causing them to alter

median horizon
lusty quest
#

store the ID as a string not as int, if you store the id as a int is possible that it gets altered

quartz kindle
#

you defined usern as display_name then gave it to deposit_credits

#

so you are doing deposit_credits(display_name, money)

median horizon
#

yea, is that incorrect?

#

does it want the id?

quartz kindle
#

yes

median horizon
#

oof

#

sorry..

quartz kindle
#

you dont want to store money based on username

#

like i said above, if you do it like this, they lose all their money if they change usernames

median horizon
quartz kindle
#

but you are giving a username to deposit_credits

median horizon
#

ok

#

imma fix it

quartz kindle
#

from the error above, the deposit_credits functions is expecting the full user object

#

so just remove the .display_name from usern

median horizon
#

oh ok

#

it worked, thanks!

dense spruce
#

hi

#

i have a problem with my script for a xp systeme

#

it can right the xp and the level but sometime it dont want to read it and it's totaly random when it dont want to work

#

sometime it work and sometime it's not

#

when it dont work it tell me 'Unexpected end of JSON input'

#

const jsonXp = fs.readFileSync(`./profils/${message.author.id}/xp.json`) const ListeXp = JSON.parse(jsonXp) const jsonStringLvl = fs.readFileSync(`./profils/${message.author.id}/level.json`) const customerlvl = JSON.parse(jsonStringLvl) const lvl = customerlvl.level_du_membre

#

here's my program

#

the problem is at the line 174

#

const ListeXp = JSON.parse(jsonXp)this one

sacred aurora
dense spruce
#

how do i do it ? 😅

sacred aurora
#
const jsonXp = fs.readFileSync(`./profils/${message.author.id}/xp.json`, 'utf-8');
#

just like that

dense spruce
#

ok thanks you so much

sacred aurora
#

the jsonstringlvl too

dense spruce
#

ok

sacred aurora
#

sure

dense spruce
#

it still do it x')

sacred aurora
#

bruh

#

try console logging the jsonxp

#

maybe its not a valid json

dense spruce
#

the json look like this : {"xp_du_membre":52}

sacred aurora
dense spruce
#

but the json work at 100% with another command

sacred aurora
#

welp

dense spruce
#

how do i log with the console 😅

sacred aurora
#

console.log(the thing)

dense spruce
#

ah yes

#

sorry i miss understand x)

rigid sandal
#

Hey

#

so i got a dropdown menu

#

that shows the contents

#

and the button doesnt work

#
<html>
<head>
<title>LateSocialChat</title>
<meta charset="UTF-8">
<meta name="description" content="A Platform being developed">
<meta name="keywords" content="social, community">
<meta name="author" content="Matthan Sutton">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
	<link rel="stylesheet" type="text/css" href="css/welcome.css">
	<script src="home.js"></script>
</head>
<body>
<div class="dropdown">
	<div class="hidden">
  <span tabindex="0">menu</span>
   <div>
         <a href="#">https://www.latesocialchat.com/registration.html</a>
    <a href="#">https://www.latesocialchat.com/login.html</a>
    <a href="#">https://www.latesocialchat.com/about-us.html</a>
   </div>
   </div>
</div>
<h2>Late social chat</h2>
<p></p>
<footer>

</html>```
#

I did steal the css and js for it but I am learning css and js

#
toggle between hiding and showing the dropdown content */
function myFunction() {
  document.getElementById("myDropdown").classList.toggle("show");
}

// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
  if (!event.target.matches('.dropbtn')) {
    var dropdowns = document.getElementsByClassName("dropdown-content");
    var i;
    for (i = 0; i < dropdowns.length; i++) {
      var openDropdown = dropdowns[i];
      if (openDropdown.classList.contains('show')) {
        openDropdown.classList.remove('show');
      }
    }
  }
}```
dense spruce
#

it log nothing @sacred aurora x')

sacred aurora
#

oof

#

thats why

rigid sandal
#
.dropbtn {
  background-color: #4CAF50;
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
}

/* The container <div> - needed to position the dropdown content */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
  display: hidden;
  position: absolute;
  background-color: #f1f1f1;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}

/* Links inside the dropdown */
.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #ddd;}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {display: block;}

/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {background-color: #3e8e41;}```
dense spruce
#

so i have to recreate the file ?

sacred aurora
#

does the file actually exist?

dense spruce
#

yep

sacred aurora
#

and there's a json inside of it?

#

it should log the json tho

dense spruce
#

everything is existing

#

there are the json

#

and the xp inside of them

sacred aurora
#

try utf8

#

without the -

dense spruce
#

same thing

#

unexpected end of json input

tardy hornet
#

how can I directly push the data into the json.sqlite file?

(quick.db)

dense spruce
#

im becoming crazy with it x') i've tried everything but still not working

rigid sandal
sacred aurora
#

hmmm

#

works fine for me tho

dense spruce
#

what mine the 'tho' (im french) x) @sacred aurora

delicate shore
#

Can anyone help me setting up python on ubuntu

#

I messed up pretty badly

dense spruce
#

thanks

sacred aurora
#

hm

#

is it working now?

dense spruce
#

no

sacred aurora
#

oof

dense spruce
#

idk what to do now x)

summer acorn
#

so, using Docker Compose with mongodb, and apparently after making the db be offline for a little bit, the data was lost. ravy said it's probably because of a bad Docker Compose config, but I don't know how to work with Docker Compose so I had Link set up a config for me (since he offered it), but now I am not sure what parts of the config is bad.
This is the docker-compose.yml file https://pastebin.com/j5KNTEDa
I'll need some help figuring out what is wrong with the config seen as I am completely new to Docker Compose.

dense spruce
#

wait i have a final idea x') @sacred aurora

sacred aurora
#

what's that

radiant shale
#

A

dense spruce
#

as the xp is readed just before it what if i moove the code with that he read the xp which work to be read

#

sorry for my bas english x)

sacred aurora
#

hmmm

#

try it first

#

i don't really get it

#

or try checking the xp json thats being read

#

maybe it really is empty

dense spruce
#

it's f*********** working @sacred aurora draquoPog

sacred aurora
#

:v

#

congrats brv

dense spruce
#

thanks

#

im so happy x)

sacred aurora
#

lol

dense spruce
#

i spend more than 3 day on it

#

lol

cinder patio
#

you code it

dusty onyx
#

hi how can i check a row exists with postgresql? im using select exists(select 1 from testtable where serverid=$1 but i dont get a true or false, i get SELECT 1

cinder patio
#

You make your bot's application via the developer portal, you have to code it yourself

#

Read this

modest maple
dusty onyx
#

idk man just one of the results on so i was trying

#

ill try that then

lusty quest
boreal delta
#

...

cinder patio
#

I don't think you understand how bots work... You don't write your code in the dev portal - the dev portal is used to get your bot token

misty sigil
#

don’t make a bot as a first project

#

learn JavaScript first

#

Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we'd like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie's Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
jsfirstbotlater learnjs

cinder patio
#

well you don't need javascript, I'm pretty sure you can make one in Lua if you know it

misty sigil
#

fair enough

#

what

cinder patio
#

Minecraft's written in java

#

It's safe

#

,but make sure you understand what the code you're running is doing

#

After you install node.js you can run the js code on your pc

#

Uh... anywhere? You write your code down in a .js file, and use node.js to run it

modest maple
cinder patio
#

Hey how old are you if you don't mind me asking

eternal osprey
#

hey so i am trying to upload my id to discord

#

but it keeps saying this:

#

no matter how i take my picture, flash off/on.

earnest phoenix
#

you don't know how old you are?

eternal osprey
earnest phoenix
#

I was replying to Light's Good's "idk"

eternal osprey
#

ah okay

#

so the dc verification brings you to stripe right?

#

before i hand my ID in to some randoms/thiefs.

cinder patio
# eternal osprey

Try taking a less blurry picture, make sure the ID is clearly visible against the background, try with a different background

eternal osprey
#

yeah i could click continue anyways

#

however, is this dc verification linked to stripe?

cinder patio
#

yeah

#

Of course

eternal osprey
#

Just scared to hand in my id. Call me stupid or something, but i have got low trust issues tbh.

eternal osprey
cinder patio
#

How can someone possibly fake that

quartz kindle
#

discord requires your documents to verify your identity

eternal osprey
#

idk, just wanted to confirm that.

eternal osprey
quartz kindle
#

and yeah, DMs from the system bot cannot be faked

eternal osprey
#

What does your application do? Please be as detailed as possible, and feel free to include links to image or video examples.can i just grab the info from top.gg and paste it in this field lmao?

slender thistle
#

Technically sure if it's relevant

eternal osprey
#

is there any time limit of when user-ids should be wiped from a database>?

#

No right?

eternal osprey
cinder patio
eternal osprey
#

thank you!

#

look i am kinda new, so sorry for asking so much.

#

WHAT IS THE PROCESS FOR USERS TO REQUEST DELETION OF THEIR DATA?

#

tbh, they can't.

quartz kindle
#

why not?

eternal osprey
#

because this belongs to a warn command.

quartz kindle
#

even after they left the guild?

eternal osprey
#

owh yeah that can be done ofc.

cinder patio
#

Isn't it useful to keep warnings even after a person leaves though?

quartz kindle
#

you could say that you keep them for like 1 month after they leave the guild or something like that

eternal osprey
quartz kindle
#

they wont check if you're telling the truth

slender thistle
#

Liar liar pants on fire

cinder patio
#

I mean, if all you're storing is their ID and amount of warnings, then is it considered thair data? thonkku

#

I guess

quartz kindle
#

im pretty sure discord IDs are not considered personal information

eternal osprey
#

WHAT SYSTEMS AND INFRASTRUCTURE DO YOU USE? okay dafuck?

#

Do they mean, like databases? Vps?

quartz kindle
#

yes

eternal osprey
#

mongodb twerking

#

okay thanks.

cinder patio
#

Would decline your app if you wrote json database smirk

eternal osprey
#

but i don't think that they would actually decline it just because of a json database.

earnest phoenix
#

well

#

it's quite possible they would

#

because there's no data encryption whatsoever

eternal osprey
#

yeah i use mongodb atlas

#

but made a back-up in json format. And saved that in my vps. The json doesn't contain any info of users, just the file format for the mongodb)

#

Is that an issue?

#

If yes, i will just delete that.

devout notch
#

whats the problem with json databases?

#

they're fast, reliable

cinder patio
#

it's not meant to be used as a database, it's not fast and it's not reliable

earnest phoenix
#

they're slow and unreliable

earnest phoenix
#

take a look at this

earnest phoenix
#

seems like a gray area to me

#

just to be safe i would encrypt the file contents

#

but keeping a backup is fine

eternal osprey
#

okay thanks!

#

how would i even encrypt a json file. I will actually just watch a tutorial and try that out!

devout notch
earnest phoenix
#

doesn't matter

devout notch
#

I just use multiple files and read/write using filesystem

#

in the message you mentioned I read that you cannot write multiple things at the same time in a JSON file?
Thats not really true as you can read the file (an object) and modify multiple keys/values simultaneously

#

then just clear the file and write it again, we are talking about nanoseconds here

earnest phoenix
#

that's completely false lol

#

you're modifying the object in your code

eternal osprey
#

i've been using json files a lot, believe me it sucks.

earnest phoenix
#

and then saving the object

devout notch
earnest phoenix
#

you cannot read and write simultaneously

devout notch
#

and can you do that with a SQLDb?

earnest phoenix
#

one has to happen after the other

#

sure

#

any proper database is built to handle large queries, multithreading and concurrency

eternal osprey
#

wait i am actually a bit confused now.

earnest phoenix
#

a proper database has more layers than just saving to a file

eternal osprey
#

for a warn, kick, ban unban etc commands, would you need the server members intent?

earnest phoenix
#

that entirely depends on your code

eternal osprey
#

Or wait yeah i do, for the total user count.

#

does anyone know a good image posting site?

devout notch
#

do you know any good ones?

eternal osprey
quartz kindle
#

you can edit a json object in memory as much as you want, but when you write it to disk, you can only write it all at once, so if the file gets big, writes get slow.
a database can actually write to disk concurrently, by changing the bytes of only a part of the file, and not the full file, so they can concurrently write multiple operations on the same file

devout notch
#

yeah true, the commands are all asynchronous and they might take a while

#

but thats what I was meaning to ask, how big is big?

delicate zephyr
quartz kindle
devout notch
#

okay I didn't expect that

#

thanks for the advice guys

cinder patio
eternal osprey
#

whaa? what is this

quartz kindle
#

considering a typical HDD writes at an average of 50MB/s, writing 1mb will take 20ms, while databases typically write in less than 1ms

earnest phoenix
#

server dbs also often keep a first and second level memory cache

#

to improve your access time

modest maple
#

most stuff will get buffered somewhat

quartz kindle
#

and databases are also protected against crashes by ensuring the change is either fully written or not written, avoiding data corruption

eternal osprey
quartz kindle
#

you must write between 100 and 2000 characters in those fields

devout notch
quartz kindle
#

using the better-sqlite3 library on npm

vernal moth
#

Does anyone know how to get the user's tag when the bot joins a server? or how to get the user's tag with a user ID?

cinder patio
#

the user who invited the bot?

devout notch
#

perfect I use npm aswell, I'll try it out thanks bruddah

vernal moth
devout notch
#

Im pretty sure everybody here uses npm lol

rancid bramble
#

lol\

vernal moth
#

same

modest maple
#

nop

cinder patio
#

Guild.owner will return the object of the owner, Guild.ownerId will return only the id

modest maple
#

cuz i dont use nodejs fingergunz

cinder patio
#

Guild.owner could be undefined because the user may not be cached

eternal osprey
#

Validation errors: infrastructure_third_party_accounts_description: Must be between 100 and 2000 in length. intents_use_case_supplemental_material_description: Must be between 100 and 2000 in length.

#

what.

cinder patio
earnest phoenix
#

multi langual app gang

eternal osprey
#

owh

quartz kindle
#

fetch it

cinder patio
#

Yeah, so you have to fetch the user yourself using Guild.ownerId

eternal osprey
#

yeah i see that, but i don't even see a third_party_accounts_description

vernal moth
quartz kindle
#

await guild.members.fetch(guild.ownerID)

vernal moth
#

oh

#

thanks :))

quartz kindle
vernal moth
quartz kindle
#

thats why await

vernal moth
#

wait

modest maple
#

btw is anyone who's good at JS interesting in WebRTC eyes_shaking

vernal moth
#

im bad at everyhting :P

devout notch
#

add async before the function

eternal osprey
#

what the fuck should i add then?

devout notch
#

oh sorry I replied to Youtube_101

eternal osprey
#

lorem ipsum.

untold ingot
#

am i allowed to ask help in coding

quartz kindle
eternal osprey
#

or wait, it is connected to my vps as well as mongodb right?

quartz kindle
#

but you are allowed to ask the question directly

boreal iron
#

lmao

lament rock
#

third party auth services would be like routing logins through reddit and whatever other places

eternal osprey
#

owwh

quartz kindle
#

:^)

vernal moth
#

I made an async function

eternal osprey
vernal moth
untold ingot
#

so i made a bot and i did all variables and all commands at last i wanted to add playing status and tried all the ways it is not working

#

so i need help

earnest phoenix
cinder patio
earnest phoenix
#

not the fetch

quartz kindle
#

the await is in the wrong place

vernal moth
untold ingot
#

@eternal osprey here?

#

or dms

eternal osprey
#

here

untold ingot
#

@eternal osprey how its very big

lament rock
#

I don't think you understood what I said. You can do an oauth flow through reddit to get user reddit info.

quartz kindle
#

show only the part about the status

#

not everything

untold ingot
quartz kindle
#

then add it back

untold ingot
#

i need help someone adding it properly

quartz kindle
#

first try adding it yourself, then if it doesnt work, shows us what you did, and we will correct you

vernal moth
#

im kinda dumdum when it comes to fetch but is this right?

untold ingot
#

it says wrong

quartz kindle
#

dont need to put it separately

vernal moth
#

OH

quartz kindle
#

you can also do console.log(await ....)

untold ingot
quartz kindle
eternal osprey
#

tim btw, sorry for asking you again, but what is the exact issue of my background not loading in?

quartz kindle
#

its easier to see your code that way

untold ingot
#

but the file is that bad

eternal osprey
#

I changed everything, tried every non-encrypted image.

quartz kindle
#

nobody bothers downloading files

eternal osprey
#

However, it still doesn't show any image as background

untold ingot
quartz kindle
#

plus they come as text files which people have to further edit to make it properly code highlighted

eternal osprey
quartz kindle
#

thats why general convention is that code sharing is done through code sharing services

untold ingot
#

bruh why are yall doing this to me :(

vernal moth
#

eyyy

quartz kindle
#

because you're new here, so im introducing you to how stuff works :)

vernal moth
#

it worked tyy :))

untold ingot
#

ok then wait ill do it

untold ingot
#

pls help me

#

download that file :(

quartz kindle
#

lmao

devout notch
grizzled raven
#

what file

devout notch
#

thats your file

quartz kindle
#

which part of it doesnt work?

devout notch
#

it throws an error, too many brackets closed

untold ingot
grizzled raven
devout notch
#

thats the error it throws

#

I think you opened closed the Interval function too many times

untold ingot
quartz kindle
#

ye

#

this part is too much

#

remove it

untold ingot
devout notch
#

yeah

quartz kindle
#

yes

devout notch
#

btw you should apply code conventions

quartz kindle
#

either remove that one, or this one

untold ingot
#

ok ill do it

devout notch
#

pretty print your code or something

eternal osprey
#

hey tim, could you tell me why my background isn't working.

quartz kindle
#

did you fix the things from before?

eternal osprey
#

yeah i removed the background color part.

untold ingot
#

okay?

near stratus
#

Is anyone else having problem with embedding Imgur image links ?

eternal osprey
eternal osprey
#

Not you're.

eternal osprey
earnest phoenix
untold ingot
#

    setInterval(() => { 
        client.user.setActivity(`You're Status`, {type: "WATCHING"})
    }, 40000)
        let member;
      client.guilds.cache.forEach(async guild =>{
      await delay(15);
        member = await client.guilds.cache.get(guild.id).members.cache.get(client.user.id)
      //if not connected
        if(!member.voice.channel)
        return;
        //if connected but not speaking
    if(!member.speaking&&!client.queue)
    { return member.voice.channel.leave(); } 
      //if alone 
      if (member.voice.channel.members.size === 1) 
      { return member.voice.channel.leave(); }
    });
  
    },
  });
near stratus
untold ingot
#

what is the mistake

eternal osprey
eternal osprey
near stratus
untold ingot
devout notch
untold ingot
#

can you rewrite and send me

eternal osprey
near stratus
eternal osprey
#

could anyone tell me why my top,.gg isn't adding my background?

untold ingot
#

what is spoonfeeding

devout notch
#

I'm pretty sure the problem is the fact that you're closing too many brackets

near stratus
# eternal osprey show your code.
embed =>
 (message, Title, Description, ImageArray) => {
        try {
            let a;
            if (typeof(ImageArray) === "string") {
                a = new Discord.MessageEmbed()
                    .setColor(ref.randArr(color))
                    .setTitle(Title)
                    .setImage(ImageArray)
                    .setFooter("Please Leave us a vote. [Use .vote]")
            } else if (typeof(ImageArray) === "object") {
                a = new Discord.MessageEmbed()
                    .setColor(ref.randArr(color))
                    .setTitle(Title)
                    .setImage(ref.randArr(ImageArray))
                    .setFooter("Please Leave us a vote. [Use .vote]")
            } else {}
            message.channel.send(a);
        } catch (err) {
            console.log(err);
        }
    }
boreal iron
devout notch
#

are you trying to set an array as an image?

near stratus
#

@untold ingot what was your problem again ?

near stratus
eternal osprey
devout notch
#

then you should do array[Math.random()*array.length]

#

or array[Math.floor(Math.random()*array.length)] I forgot

near stratus
eternal osprey
devout notch
#

oh my bad

eternal osprey
#

aren't links seen as links? So shouldn't you wrap it in ""

devout notch
#

but you're not using that here

near stratus
near stratus
devout notch
#

oh you're either passing a single link or an array of links and incase its a single link it runs this

near stratus
#

Don't take it too much
someone said not to use imgur for a while

devout notch
#

sorry what was your error again?

near stratus
#

there wasnt any

devout notch
#

was it just an image loading?

near stratus
#

also it wasnt posting the image

near stratus
eternal osprey
#

try to console.log the ImageArray.

near stratus
eternal osprey
#

as it contains links.

near stratus
eternal osprey
#

Try any other image sites.

#

how can i contact a mod about my top.gg page? My selected images work when i watch them in preview, but after i save them it just disappears.

#

It happened out of nowhere, after months of good use.

near stratus
boreal iron
eternal osprey
modest maple
eternal osprey
#

instead of a ping, i will just dm a mod.

near stratus
modest maple
#

again did you use the imgur link

#

or the direct link

boreal iron
#

Recently Imgur started to block http agends including TeamSpeak in the name, causing all TeamSpeak servers worldwide not being able to fetch their icons or banners anymore

modest maple
#

2 vvvvv diffrent things

near stratus
modest maple
#

shrug So thats why it isnt working lol

near stratus
#

with .png at last

modest maple
#

so thats a direct link

near stratus
modest maple
#

one is direct the other is a link to the site mmLol

modest maple
#

yikes

near stratus
boreal iron
#

That’s not a direct link. It’s getting redirected to i.imgur.com

#

Open the URL in your browser and copy the URL you see and try it in Discord.

boreal iron
#

Try it.

near stratus
#

k

#

And it still doesn't work

rustic nova
#

are you loading it properly into the embed?

#

let the image url print out into console before sending the embed

rustic nova
#

and do you use it correctly in the embed?

#

show the method

boreal iron
#

Scroll up a bit

rustic nova
#

you're loading the whole array

near stratus
rustic nova
#

or am i wrong

near stratus
rustic nova
#

i mean this

near stratus
#

"ITS FIXED GUYS IM USING DROPBOX NOW"

earnest phoenix
#

yes

#

i was just about to say

#

use another provider

near stratus
earnest phoenix
#

like i said earlier

modest maple
#

if (typeof(ImageArray) === "string") {
Amazing way to make something un-readable ftw

boreal iron
modest maple
#

🤨 Your age shouldnt be an excuse for lack of writing readable code

#

all its gonna do is make it 1) harder for other to help you and 2) harder for you to read and understand yourself shrug

sudden geyser
#

Practice makes perfection 🪄

signal wagon
#

Everybody knows that the more complicated your code looks the better it is

#

If noone understands it it must be 5head code

sudden geyser
#

No raw loops, declarative > imperative 🪄

old cliff
cinder patio
#

You're like 11 give yourself some slack

vagrant flare
#

has anyone successfully ran an aiohttp web application with discord.py for dbl webhooks? my thing works fine until after a few mins i'm assuming the websocket closes connection and i get:
OSError: [WinError 64] The specified network name is no longer available

#

the only workaround i could think of was to restart the app once it shuts down consistently, but the shutdown event happens much later

opaque seal
#

Does anyone here use influxDB?

#

I've got a bunch of logs, for example, every time a command is used I save a point in my influxDB with the command_name, the user_id of who used it and the timestamp obv. Now, how do I turn all these logs in a nice graph in the influx dashboard, I would like for example to have a graph that showed the total number of commands used that grows through time.

signal wagon
#

Grafana™️

river thistle
#

grafana

#

grafana is a very good option for what you want to do

earnest phoenix
vagrant flare
#

im using a TCPsite which uses a TCPsocket

#

anyway, i decided to host the web server separately and have multiple connections to the DB instead

tulip ledge
#

Hi so I have this array: let levels = [50, 100, 250, 750, 2500] and a number of xp for example: 150 now I need to use that XP to get the level + progress to the next level this function should return 2.33 (since 150 is bigger then 100 (2nd index) and smaller then 250, but is 1/3rd of the way to 250 (level 3)) how would I start on this function? I already have the part to find the level but not the progress: levels.findIndex((num) => num >= Math.floor(xp))

earnest phoenix
#

what

opaque seal
#

250 - 100 : 100 = 150 - 100 : x

#

i.g

#

don't know tho try it

opaque seal
opaque seal
# opaque seal 250 - 100 : 100 = 150 - 100 : x

250 is the xp of the next level while 100 is the xp of the previous one, the other 100 instead, the one after :, stands for 100%.
The 150 after the = is the current xp and x is the percentage to calculate

#

@tulip ledge

opaque seal
tulip ledge
#

so

opaque seal
tulip ledge
#

right

opaque seal
#
function calcLevelAndProgress(levels, currentXP) {
// Your code to see the level
const currentLevel = levels.findIndex((num) => num >= Math.floor(xp))

const progress = 100 * (currentXP - levels[currentLevel - 1]) / (levels[currentLevel] - levels[currentLevel - 1]) 
}
tulip ledge
#

alright ty very much

opaque seal
#

But you have to keep in mind about the first level, which doen't have a previous one

#

So

tulip ledge
#

oh yeah I'll put a 0 as index 0 and to const progress = 100 * (currentXP - levels[currentLevel]) / (levels[currentLevel + 1] - levels[currentLevel])

opaque seal
#
function calcLevelAndProgress(levels, currentXP) {
  // Your code to see the level
  const currentLevel = levels.findIndex((num) => num >= Math.floor(currentXP))

  const xpPreviousLevel = currentLevel - 1 > -1 ? levels[currentLevel - 1] : 0

  const progress = 100 * (currentXP - xpPreviousLevel) / (levels[currentLevel] - xpPreviousLevel) 

  return {
    level: currentLevel,
    progress: progress
  }
}

Or that

#

Which I think is more straight forward

rich heart
#

if (args[0].toLowerCase() === "store") {

Error: ```
TypeError: Cannot read property 'toLowerCase' of undefined
EXTRA INFO:
TypeError: Cannot read property 'toLowerCase' of undefined
at Object.run (C:\Users\David\Desktop\Bot\addons\ADavid_test.js:24:21)
at module.exports (C:\Users\David\Desktop\Bot\events\message.js:519:31)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

#

How to fix on this?

devout notch
#

you haven't defined args

#

if its a function make sure you passed through the args var

#

or make sure args are defined globaly

slender wagon
#

so i am trying to implement voice chat levels on my discord bot, how do i log a users voicechat activity? I am still unsure

devout notch
#

Im not sure tho

earnest phoenix
#

once you detect that a member is in a channel, store when it happened
once they leave the channel, get the date you previously stored and calculate your xp based on that

#

the same principle would be applied if a user wanted to check their xp

#

if the member is in a voice channel, get when it happened and calculate the xp at the time of the command execution

#

you would obviously mix in a database there

#

oh also

#

account for your bot downtimes

#

whenever you receive the ready event go through every guild's voice channel to see if any members are in there that your bot wasn't tracking yet

#

and start tracking those

slender wagon
#

ohh

#

okay tysm!

earnest phoenix
#

Hi, i would like to use Mongodb Triggers in my node.js app. Basically receiving events when a document has been: Updated, Deleted or Created. Is there any easy way/npm package to do it? Also I'm using mongoose as my driver.

quaint wasp
#

since when did discord change purge messages max time from 30 days, to 14?

earnest phoenix
#

age*

#

it was always like that

quaint wasp
#

Idk.. I feel like it used to be 30 days..

#

But now I need to make that thing that will reply if error happened..

earnest phoenix
#

always was 14d

quaint wasp
#

fine..

quaint wasp
cinder patio
quaint wasp
#

I did catche... but now it says its undefined..

cinder patio
#

define it

earnest phoenix
#

TypeError: message.channel.fetchMessages is not a function

cinder patio
#

If you're using >= 12 all methods for messages got moved toChannel.messages

earnest phoenix
earnest phoenix
cinder patio
#

np

earnest phoenix
#

TypeError: Cannot read property 'emit' of undefined

#

f

feral skiff
#

Does mee6 have a lot of expenses since it’s in 10m+ servers?

solemn latch
#

Yes

earnest phoenix
#

yup

solemn latch
#

Afaik it has pretty much a full staff team anyway

#

So that's pretty expensive

cinder patio
#

Ugh why doesn't eslint auto-fix the linebreaks-style rule

earnest phoenix
#

I want my purge to ignore pins, anyone knows how could I do it?

cinder patio
#

If you're using the bulkDelete method then I don't think you can filter out pinned messages

cinder patio
#

Actually you can specify the messages to delete

#

so I guess it's doable

#

You have to fetch the last N messages and filter out all pinned messages (by checking the message's pinned property)

devout notch
#

do message have like a pinned property?

cinder patio
#

yes

earnest phoenix
#

.filter(message => !message.pinned)

#

.filter(m => !m.pinned)

#

?

#

same?

cinder patio
#

But then you wouldn't be deleting N amount of messages, but N - pinned, if you're ok with that then this is a good solution, if not then you'd have to do some more fetching

earnest phoenix
cinder patio
#

nope

cinder patio
#

you need to filter fetched (assuming it's the messages you fetched), not the return value of the bulkDelete

devout notch
#

I would just fetch all the messages from a channel
(await message.channel.messages.fetch();)

then while the specified amount of messages is greater than the deleted messages: if message.pinned, delete the message and increment deleted, else just move on to the next message I guess

#

does that make sense ?

#

I could write it in javascript if you want me to

cinder patio
#

using bulkDelete is better and less spammy

#

if the user wants to delete 100 messages you'd have to first fetch those 100 messages and then make a HTTP request for one of them - that's 101 requests

#

Using .fetch and .bulkDelete is just 2

devout notch
#
let messages = await message.channel.messages.fetch();

let toDelete = parseInt(args[0]);
let deleted = 0;

for(let i = 0; toDelete > deleted; i++)
    if(messages[i].pinned){
        message.delete()
        deleted++;
    }
#

not quite sure if that would work tbh

#

you would have to do .purge <amount of messages to delete>

#

thats why I wrote parseInt(args[0])

cinder patio
#

It's spamming the API

earnest phoenix
#

weit wut

devout notch
#

it is but how else would you do it

quartz kindle
#

.fetch() fetches only 50 messages by default

earnest phoenix
#

i knwo but

cinder patio
#

Fetch the messages, filter out the pinned ones, use bulkDelete

earnest phoenix
cinder patio
#

2 HTTP requests

devout notch
odd stratus
devout notch
cinder patio
#

It's exactly that - ignore pinned messages

devout notch
#

how are you ignoring them if you're bulkdeleting lol Im so dumb

devout notch
#

I dont get it

earnest phoenix
#

thank u so much guys

#

fetching != bulk deleting

cinder patio
#

You're first fetching the N messages, then you're filtering out the pinned ones, and then you're using .bulkDelete

devout notch
#

oh I thought you just fetched then bulkDeleted

devout notch
#

I saw 2 HTTP requests and thought you meant 2 commands

winter thunder
#

What shards do exactly?

earnest phoenix
winter thunder
#

And is it benefic to my bot?

solemn latch
#

It is if you need it

earnest phoenix
#

discord sharding stays true to the meaning of shard, you split a big thing into a bunch of smaller things, ergo shard

cinder patio
earnest phoenix
devout notch
#

yeah I get it now I just thought you said fetch messages then just bulkdelete them

#

(without filtering)

earnest phoenix
#

How does it work

#

what is it

#

@devout notch @cinder patio leave that point lawl

rigid sandal
#

The css file wont load for the html file

glacial pagoda
#
    const command = args.shift().toLowerCase();
    
   
    if (!cooldowns.has(command.name)) {
        cooldowns.set(command.name, new Discord.Collection());
    }
    
    const now = Date.now();
    const timestamps = cooldowns.get(command.name);
    const cooldownAmount = (command.cooldown || 3) * 1000;
    
    if (timestamps.has(message.author.id)) {
        const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
    
        if (now < expirationTime) {
            const timeLeft = (expirationTime - now) / 1000;
            const avatar = message.author.avatarURL({ dynamic:true });
            const Embed221r = new Discord.MessageEmbed()
            .setColor('RANDOM')
            .setDescription(`**Sorry <@${message.author.id}>, You Need To Wait \`${timeLeft.toFixed(1)}\` More Seconds Before Using \`-${command.name}\` Again**`)
            .setFooter(`Yep, Need To Wait`, `${avatar}`);
            
            
            return message.reply(Embed221r);
        }
    }
    timestamps.set(message.author.id, now);
    setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);```
#

I Keep getting this error

earnest phoenix
#

why when I press test webhook it dont work withm e

#

me'

glacial pagoda
#

Can Someone Help me

#

I Need Help Defining it

#

Idk What To Put To Make It Valid

devout notch
#

can you paste the code in line 80

glacial pagoda
#

ok

#

80 or 89?

devout notch
#

oh yeah 89 sorry

#

looked like 80

glacial pagoda
#

const timeLeft = (expirationTime - now) / 1000;

devout notch
#

have you defined timeLeft somewhere else in your code?

#

if you have, then remove the const

glacial pagoda
#

lemme check

#

no

devout notch
#

then I have no idea

glacial pagoda
#

Want Me To Paste My Whole Main.js?

devout notch
#

yeah go ahead

crystal wigeon
#

anyone know sailsjs?

glacial pagoda
#

@devout notch

crystal wigeon
#

nobody?

#

how would i detect multiple file uploads in sailsjs

#

;-;

#

sad

devout notch
glacial pagoda
#

huh

devout notch
#

The code was probably pasted differently because I dont see a line 89

glacial pagoda
#

oh

#

well it says timeleft is not defined

#

so wouldnt you expect it to be in const timeleft?

devout notch
#

I mean it doesn't make sense as you're defining timeLeft by using const but it says it is not defined

glacial pagoda
#

ikr

crystal wigeon
#

show your full code snippet

devout notch
#

are you sure the line you pasted is line 89? Im asking because it says the error is at position 76

#

but the line you've sent doesn't even have 76 characters

crystal wigeon
#

lol

glacial pagoda
#

I just restarted the code and it worked?

#

wat

#

I think it was a glitch

devout notch
#

lol shit happens

glacial pagoda
#

lol

earnest phoenix
#

you were running an old instance

glacial pagoda
#

ok thanks!

devout notch
#

I mean I was pretty much useless but no problem xD

glacial pagoda
#

Oml now there is another problem, when I do any command it has a cooldown

#

of 5 sec

#

I think it has to do with the 3

earnest phoenix
#

what in the literal fuck is your command handler lol

glacial pagoda
#

Lol

earnest phoenix
#

why are you doing this

glacial pagoda
#

its specific

slender thistle
#

lol what

#

why

glacial pagoda
#

cuz specific

devout notch
#

I would use switch case

earnest phoenix
#

you're aware you can just

const commandObject = get(command);
if(commandObject)
  commandObject.execute();
slender thistle
#

That's rather unnecessary

earnest phoenix
#

right?

#

also

glacial pagoda
#

no lol

earnest phoenix
#

instead of stacking arguments

#

create a context object

#
const commandObject = get(command);
if(commandObject)
  commandObject.execute({
    client: your client,
    message: message,
    ...and so on
  });
#

then in your command you can just

#
execute: (context) => {
  //you now have access to all of those variables
  context.client...
};
#

clean up that clusterfuck

glacial pagoda
#

lol

#

I took away the 3 and no commands have a cooldown

#

Bruh

earnest phoenix
#

you should refactor your entire command handler before you implement cooldowns

solemn latch
#

you should have some amount of cooldown on every command