#development

1 messages · Page 909 of 1

cinder patio
#

Put () => true in place of filter

sacred mountain
#
message.channel.awaitMessages(() => true {max: 1, time: 5000}).then(collected => {```
cinder patio
#

comma after true

sacred mountain
#

k

#

new problem

#

the message calling up the awaitMessage is counted as a response

#
            message.channel.awaitMessages(() => true, {max: 1, time: 5000}).then(collected => {

                console.log(message.content)

            }).catch(err =>{
                console.log("err")
            })``` it instantly just logs the message that brought up the await message function
#

without waiting for a new message

pale vessel
#

.catch(console.error) mmLol

sacred mountain
#

Now I have a error

#
            }).catch(console.error =>{
                console.log("err")
            })
pale vessel
#

???

#

what

#

.catch(console.error) mmLol
is enough

sacred mountain
#

oh

pale vessel
#

or .catch(console.log), doesn't matter

cinder patio
#

that's weird... well you can put msg => msg.id !== message.id that way it won't detect the message, though I don't think it should in the first place.

#

Or you can set max to 2 and get the collected message via collected.last()

sacred mountain
#

Ohh

#

Umm

#

It now logs a TONNE of random stuff about the channel

#
            message.channel.awaitMessages(() => true, {max: 2, time: 5000}).then(collected => {

                console.log(collected.last())


            }).catch(console.error)```
cinder patio
#

yes, collected is a collection of messages

sacred mountain
#

oh

cinder patio
#

collected.last() gets the last message

sacred mountain
#

how would i log the actual content?

#

collected.last.content?

cinder patio
#

yeah but last is a function, so last()

sacred mountain
#

collected.last().content?

cinder patio
#

yup

sacred mountain
#

Works

#

Thanks

cinder patio
#

you should always check if collected.last() actually exists, though. Afaik awaitMessages only throws errors when you tell it to

sacred mountain
#

Oh

opaque seal
#

Is there a way to go around the 25 field limit of an embed?

pale vessel
#

no

opaque seal
#

rip

pale vessel
#

send a new embed

#

that's it

cinder patio
#

You can use a webhook to send multiple embeds also

vivid crescent
#

Just use pagination

opaque seal
#

I have an help command which lists all my bot commands in different pages, using reactions to change pages. But On one page I use more than 25 fields for the commands so I guess I'll have to create a new page

#

Just use pagination
Yeah , my commands are divided by category, but one category has to many commands, so them don't fit all in one page

vivid crescent
#

Each command uses a field? Why not just write the name of each to the description?

opaque seal
#
if(page === 2){
                            embed.fields = [
                                { name: 'Means everyone in the server can use them', value: '\u200B' },
                                { name: 'Prefix', value: `Remember, every command has to be preceded by the \`prefix\` \nThe prefix, in this server, is ${prefix}\nYou can always use commands by tagging <@${message.client.user.id}> \n(example: <@${message.client.user.id}> help )` },
                                { name: '\u200B', value: ':small_red_triangle_down:Command', inline: true },
                                { name: '\u200B', value: ':small_red_triangle_down:Description', inline: true },
                                { name: '\u200B', value: 'Usage :arrow_heading_down:', inline: true },
                            ]
                            for(i = 0; i<cMembers.length; i++){
                                embed.addFields(
                                    { name: '\u200B', value: ':small_orange_diamond: `'+cMembers[i].name+'`', inline: true },
                                    { name: '\u200B', value: `${cMembers[i].description}`, inline: true },
                                    { name: '\u200B', value: `${prefix}${cMembers[i].name} ${cMembers[i].usage}`, inline: true },
                                )
                            }  
                        }
```It's pretty neat like that
prime cliff
#

@opaque seal you know that would look very bad on mobile

opaque seal
#

Uh

#

let me see

pale vessel
#

uh-oh!

opaque seal
#

yeah

#

xD

#

I meann, not too bad

#

Just a bit

prime cliff
opaque seal
#

So all in one field? that's what you are saying?

prime cliff
#

Or if your lib supports it just check for mobile status and do an embed that looks good for mobile

opaque seal
#

That's a lot of work

#

gonna do it

cinder patio
#

why not have a site with all the commands if you know html + css?

#

It doesn't have to be like a dashboard

opaque seal
#

I was planning to make a dashboard for managing the bot

#

But I don't think I have the knowledge to do that still

#

I'm learning

#

why not have a site with all the commands if you know html + css?
All of them are on the bot page of top.gg

#

The help command was just an additional thing

#

why not have a site with all the commands if you know html + css?
Also I would love to, but I don't wanna rush learning all that stuff

earnest phoenix
#

using your topgg bot page is good enough for now

opaque seal
#

Yeah think that too, I'm just gonna add another page to the help command. I'll think about the mobile stuff in the future

glass crag
#

Whats the best way to send an Embed Message through BroadCastEval (using Shards)?

cinder patio
#

you shouldn't

glass crag
#

What's the best approach?

#

Trying to invoke a function on a client/shard causes "Discord = undefined"

nocturne grove
#

Omg I want to cry... my bot joined a fairly large server, which was Chinese. I have even tested my MySQL database on Chinese characters, nothing wrong. But why doesn't it accept them now? I was using utf8mb4_unicode_ci

#

now it left the server because of this

modest maple
#

arnt chinese characters utf16?

nocturne grove
#

but that's not an option in MySQL

#

oh wait utf16 is

#

but not mb4

#

utf16 and 32 not working 😦

sacred mountain
#

Hi. How can I use an invite link in discord.js. Basically what I’m trying to say is that it creates an invite link but I then want it to log the link to the console. How would I do that?

modest maple
#

dont

#

bad

sacred mountain
#

Why

placid crown
#

guys let's say i want my bot to do something every time someone votes for it on dbl. I'd call the dbl.on_dbl_vote(data) within the main.py of my bot?

modest maple
#

because ToS exists and say invasion of privacy creating and logging invites to servers your bot is in

sacred mountain
#

Well I’m not exactly logging it

#

I said that as an example

modest maple
#

log the link to the console.

nocturne grove
#

Omg I want to cry... my bot joined a fairly large server, which was Chinese. I have even tested my MySQL database on Chinese characters, nothing wrong. But why doesn't it accept them now? I was using utf8mb4_unicode_ci
^ confirmed idiot again

#

🙂

earnest phoenix
#

how do you delete duplicate entries in phpadmin

turbid bough
#

why is @ everyone a role

tight plinth
#

¯_(ツ)_/¯

earnest phoenix
#

because it is

#

and... everyone is in it

turbid bough
#

yeah but now i need to check if they are trying to add @ everyone as rank 😐

modest maple
#

isnt it just the guild id

#

for the role id

pale vessel
#

yes

turbid bough
#

yah it is just one extra line of code

earnest phoenix
#

For some reason my database is adding duplicate rows when someone does a command when it's set to UPDATE not INSERT

#

strange

turbid bough
earnest phoenix
#

How i can check does user.id have been exist in database

#

@turbid bough me 2

#

Wait the website have been hacked ?

#

or ssl expired

turbid bough
#

ssl certificate expired

earnest phoenix
#

anyone know my issue at all?

#

niceee

#

NICEEE

topaz fjord
#

SSL cert expiring doesn't mean it got hacked

earnest phoenix
#

bruh just asking

topaz fjord
#

they just forgot to renew the cert

earnest phoenix
#

ye

#

ik

#

How i can check does user.id have been duplicated in database ?

vague kite
#

If I'm using collector for emotes, how would I end it when the user just reacts with 1 emote.

collector.on("collect", async(reaction, user) => {

if(reaction._emoji === emote1){
return message.channel.send(...)
}

});

So I'm currently do something like this, should the return not end the collector??

cinder patio
#

You must use the .end function to end it

#

like collector.end()

hasty sparrow
#

@earnest phoenix Either select from database where user id, if a value is returned it exists or use an "on duplicate" query

vague kite
#

Ahhh okay thx ❤️

cinder patio
#

@vague kite you can also just specify the amount of emotes you want to collect

vague kite
#

max: 1 right?

cinder patio
#

yup! In the options parameter

vague kite
#

Yeah I'll do that

#

Thanks

earnest phoenix
#

andesite vs lavalake

#

which is better

turbid bough
tardy estuary
#

is this coming from the web app discord?

turbid bough
#

from my website, but im using discord oauth

earnest phoenix
turbid bough
#

node

earnest phoenix
#

no idea then

#

asp.net recently added changes to support Chrome's enforcement of SameSite cookies

turbid bough
#

idk i guess ill just ignore it for now

copper cradle
#

it's just a warning

turbid bough
#

feels much better

#

i dont really like to ignore warnings, and saying "its just a warning"

#

what exactly are warnings even for then

copper cradle
#

it's just a warning

merry portal
#

Im traying to make a discord and when I do node . this happens ReferenceError: discord is not defined

turbid bough
#

Have you defined discord?

merry portal
#

what do you mean

turbid bough
#

const discord = require('discord');

merry portal
#

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

#

thats that i put

amber fractal
#

case matters

turbid bough
#

big D

merry portal
#

const Discord = require('discord.js');
const bot = new Discord.Client();

const token = ' ';

bot.on('ready', () =>{
console.log('This bot is online');
})

bot.login(token);

#

thats what I put

turbid bough
#

idk where you got that error though

merry portal
#

ok

turbid bough
#

wrong file?

quartz kindle
#

if thats the code you have, then its correct

merry portal
#

idk what i did wrong

turbid bough
#

you probably executed the wrong file

quartz kindle
#

the error says that you have a discord somwehre when it should be Discord, so either you are showing the wrong file, or you didnt save the file

merry portal
#

ok

#

ReferenceError: discord is not defined
at Object.<anonymous> (C:\Users(Classfied)\Desktop\Discord bpt\index.js:2:14)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47

quartz kindle
#

show your index.js file

quartz kindle
#

you didnt save the file

amber fractal
#

you didnt save

merry portal
#

wait it went on

amber fractal
#

also regen your token

turbid bough
merry portal
#

i saved it and itt workedn

#

ya i did

#

bruh

#

sorry for all the toruble

amber fractal
#

you need to save for changes to take effect

merry portal
#

its my first time coding

#

ya

turbid bough
#

i mean, is it your first time writing a document too?

#

it thought my bot was offline for a millisecond

merry portal
#

yea

copper cradle
#

you need to save for every change to take place

#

have you ever written a word doc or an excel spreadsheet?

merry portal
#

no

copper cradle
#

how come

merry portal
#

idk

#

i dont have the time

#

now I do

turbid bough
#

just keep CTRL + S clicked all the time

#

make it your muscle memory

merry portal
#

ok

#

thanks

copper cradle
#

press CTRL + S on every change

#

to save the file

#

and if you see a dot on the name of the file

#

then that means you haven't saved it

merry portal
#

yea ok

cinder patio
#

you can also enable auto-saving

merry portal
#

how

#

ok I tured on auto saving

sudden geyser
#

I like to use auto-save when focus on the window is escaped.

turbid bough
#

idk, would it work with when hitting F5

quartz kindle
#

i dont use autosave lul

modest maple
#

i do

sudden geyser
#

how do you live without it?

modest maple
#

Autosave + Pycharm's local histroy system is amazing

sudden geyser
#

So many times I go to reload something but it does nothing because it wasn't saved

turbid bough
#

its my reflex on hitting ctrl+s

pale vessel
#

i don't have autosave but verbose backup so every time i save, it makes a backup of the previous version, in case of corruption

#

and i use Ctrl s every time i make a change lol

copper cradle
#

lol

#

not doing Ctrl + s is for lazy people tbh

restive furnace
#

i use webstorm, and its automatically enabled that it autosaves...

cinder patio
#

sorry for trying to make my life easier jeez 😳

quartz kindle
#

in one of my projects i have auto-upload on save and auto-restart on changes

#

imagine if i had autosave turned on

modest maple
#

oof

copper cradle
#

that'd be gay

earnest phoenix
#

I'm so confused my bot keeps going off every now and then without any logs or anything

restive furnace
#

discord api disconnects

sudden geyser
#

Is your bot just going offline, or is your app exiting?

remote yacht
#
Error: 503 Backend fetch failed
    at IncomingMessage.<anonymous> (/rbd/pnpm-volume/ccfc9e2e-e1fa-4dd0-838d-c3b5bb122b10/node_modules/.registry.npmjs.org/dblapi.js/2.4.0/node_modules/dblapi.js/src/index.js:118:25)```
quartz kindle
amber fractal
#

server error

#

you need to wait for a fix

prime cliff
#

When is top.gg never having issues Blob_Sweat

summer torrent
#

never™️

true ravine
#

For a good few months I never noticed any errors from here, so that's a positive

#

Or maybe I just wasn't looking hard enough

copper cradle
#

hmm

robust moth
quartz kindle
copper cradle
#

ah yes

earnest phoenix
#

i'm getting this string from moment-timezone.js, how can i convert it to a UTC epoch? using Date() Tue May 05 2020 09:53:55 GMT-0700

#

seems like Date() want it's input in this format ```js
const javaScriptRelease = Date.parse('04 Dec 1995 00:12:00 GMT');

#

anyone know an easy way to convert my former string into the format of later? or know an Date method that accepts the first format?

#

kinda surprised moment-timezone doesnt return strings accepted by Date()

mystic violet
#

Loading the bot this way, It worked before, but now it hangs for some reason.. any idea why? it doesn't give me any events.

fs.readdir("./src/event", (err, files) => {
    if(err) return console.log(err)
    files.forEach(file => {
        if(!file.endsWith('.js')) return;
        const event = require(`./src/event/${file}`);
        let eventName = file.split(".")[0];
        Client.on(eventName, event.bind(null, Client));
    })
})

fs.readdir("./src/", (err, srcs) => {
  if (err) return console.error(err);
  srcs.forEach(src => {
      if(src.includes(".")) return;
    Client[src] = new Discord.Collection()
    fs.readdir(`./src/${src}`, (err, files) => {
      files.forEach(file => {
        if (!file.endsWith(".js")) return;
        console.log(`Loading /${src}/${file}`)
        properties = require(`./src/${src}/${file}`)
        Client[src].set(properties.name, properties)
      })
    })
  })
})```
#

sorry for wall of code

#

;-;

#

It does all the "loading" js Loading /event/message.js Loading /event/ready.js but then it doesn't fire the ready event

sudden geyser
#

can you show ready.js

mystic violet
#

module.exports = async (Bot) => {

console.log("ready")
}

#

lol

digital ibex
#

instead of js console.log(`Loading /${src}/${file}`); try doing ```js
console.log(eventNames)

mystic violet
#

like this? js let eventName = file.split(".")[0]; console.log(eventName) Client.on(eventName, event.bind(null, Client));

digital ibex
#

anywhere

#

below eventsName tho, and ye, it'd work

mystic violet
#

message
ready

#

is what it returns

digital ibex
#

um

#

so it reaches it

#

i think

#

try removing the if(!file.endsWith('.js')) return;

#

i dont think that'd change anything but

#

¯_(ツ)_/¯

mystic violet
#

nope

#

:/

#

Ill just remove all commands

#

and events

#

and slowly add them back

#

see how that works

earnest phoenix
#

- vds in music cutting Is there a solution?

digital ibex
#

what

earnest phoenix
#

vds host my bot > music cutting interrupted

mystic violet
#

what library do you use for music

#

ytdl?

earnest phoenix
#

Is there an interrupted solution while listening? s

#

yes ytdl

mystic violet
#

thats why its ytdl 😂

earnest phoenix
#

-_-

mystic violet
#

use lavalink or ffmpeg or something

#

they have steadier audio

#

ffmpeg is not ytdl btw

earnest phoenix
#

you have example link?

#

give me

mystic violet
#

or you can use shoukaku or something

earnest phoenix
#

stabil?

mystic violet
#

yes

earnest phoenix
#

thanks

#

@sudden geyser> Is your bot just going offline, or is your app exiting?
Bot it just going off

#

Just shut off again and is back on

#

My vps doesn't say of anything shutting down or restarting

#

And it's off again

#

Do people think it's just the discord api I'm literally getting no errors or anything ?

mystic violet
#

uh what does this mean

429 hit on route /gateway/bot

#

it says ratelimit

#

but I just booted

#

for the first time

#

in days

#

lol

#
[WS => Manager] Manager was destroyed. Called by:
Error: MANAGER_DESTROYED
    at WebSocketManager.destroy (C:\Users\jnsho\node_modules\discord.js\src\client\websocket\WebSocketManager.js:335:54)
    at Client.destroy (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:235:13)
    at Client.login (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:224:12)```
#

im so confused

earnest phoenix
#

how can i check if a message sent is a gif

white gyro
#

The url extension will be .gif. Same for checking for other types of files

earnest phoenix
#

not only for an attachment, but also for a link being sent

#

is it an option?

vestal sequoia
#

Why do this not work? (JAVA), gets no Error just nothing is happening Tag me if you know why

white gyro
#

@earnest phoenix If the url ends with .gif it's a gif. Otherwise you can send an http get request and check that the response mime type is image/gif

earnest phoenix
#

I need a new vps anyone know any good companies

#

Dont even bother saying glitch as a troll hahaha

dusky marsh
#

I use galaxygate

quartz kindle
#

same

earnest phoenix
#

Uptime fine

#

My bot kept going off

#

I'm self hosting now and it's not gone off once

knotty steeple
#

skysilk if u want decent prices

#

for the cheap ones anyway

dusky marsh
#

ive heard good things about them too

earnest phoenix
#

I dont mind price just want a super good vps

#

My bots on 400+ servers

knotty steeple
#

and if u were in beta u get a percent off

earnest phoenix
#

I need something reliable

knotty steeple
#

but i would still use galaxygate

earnest phoenix
#

Thanks guys appreciate it I'll check them out

quartz kindle
#

how much ram do skysilk plans offer? they dont say lol

earnest phoenix
#

You think 4gb ram is enough

#

My current has 512mb which is doo doo

#

I dont mind investing the money :)

quartz kindle
#

for a non-modified discord.js, 4gb will be enough for about 10k-20k servers

knotty steeple
#

i dont remember

#

wew

quartz kindle
#

depending on what your bot does

dusky marsh
#

ive had my bot on the 3 dollar tier up to 2000 guilds or so

earnest phoenix
#

It's a bump bot

quartz kindle
#

mine is still on the $3 one, at 3000, but mine is modified

earnest phoenix
#

I'll go with $8

#

Why not

#

Thanks guys

opaque seal
#

How do I get the profile picture of a guild member

#

is it defaultAvatarURL?

late plank
#

yea

amber fractal
#

that gets their default

quartz kindle
#

in discord.js v12, all avatarURL properties are now functions

#

so you need to add ()

#

and you can use the function options to specify the format and size of the image

late plank
#

user.displayAvatarURL()

earnest phoenix
#

Out of stock apparently

quartz kindle
#

ye galaxygate got discord famous because some big bot was hosted there

opaque seal
#

in discord.js v12, all avatarURL properties are now functions
oh weird, them are still into properties in the doc

earnest phoenix
#

Imagine being out of stock

#

Hahaha

late plank
earnest phoenix
#

All servers are out of stock

amber fractal
#

wasnt some of their ips banned though?

#

discord got a ton of spam from galaxygate I thought

earnest phoenix
#

Skysilk it is

#

Skysilk alright?

opaque seal
slender thistle
#

Been using it ever since their beta, no problem with their services

earnest phoenix
#

@slender thistle skysilk?

slender thistle
#

Yup

earnest phoenix
#

100% uptime or?

slender thistle
#

Hmm... maybe 98-99% of the time

#

Some maintenance here and there sometimes but usually that doesn't last long

earnest phoenix
#

I've been using resellers

#

That have "discord hosting service"

#

Not an actual vps

vestal sequoia
slender thistle
#

imo it's just convenient to have a full machine all to yourself

late plank
#

I have a small OVH VPS that runs my bots pretty well

#

$2/mo isn't bad; but 10gb ssd feels tiny

mystic violet
#

10gb ssd is tiny

#

I got a 480gb one

quartz kindle
#

depending on what your bot does, it doesnt even need 1gb

mystic violet
#

true lmao

late plank
#

npm packages alone can take a gig away lmao

quartz kindle
#

@slender thistle how much ram does skysilk offer? their website doesnt say anything?

late plank
mystic violet
#

Hey tim, have you ever seen this error before? js [WS => Manager] Manager was destroyed. Called by: Error: MANAGER_DESTROYED at WebSocketManager.destroy (C:\Users\jnsho\node_modules\discord.js\src\client\websocket\WebSocketManager.js:335:54) at Client.destroy (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:235:13) at Client.login (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:224:12) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:11096) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided. at WebSocketManager.connect (C:\Users\jnsho\node_modules\discord.js\src\client\websocket\WebSocketManager.js:135:26) at Client.login (C:\Users\jnsho\node_modules\discord.js\src\client\Client.js:221:21)

quartz kindle
#

oh

mystic violet
#

oh

#

lol

#

I figured it out

#

just read the full error

#

smh

quartz kindle
#

did you call manager.destroy()? lmao

mystic violet
#

no I didn't

#

its weird lol

#

I just logged in

quartz kindle
#

then what was it?

mystic violet
#

(node:11096) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.

#

probably

quartz kindle
#

ah yes

mystic violet
#

Yep it worked

#

lmao

late plank
#

for $5.52 a month you can get 2gb of ram and 40gb nvme storage

#

with OVH

mystic violet
#

For free I can use my dedicated server zoop

late plank
#

heh; on your home network?

mystic violet
#

my parents pay for electricity lol

#

yep

#

100mbps down
10mbps up

late plank
#

I'd rather keep my things not on my home network

mystic violet
#

true lmao

#

get ddosed

late plank
#

I suppose you could cloudflare if you're hosting webservers

#

do you have a static IP?

mystic violet
#

Yeah static

late plank
#

nice

#

ya'll wanna see some cool graphs I've been working on?

tardy estuary
#

a bot running on a home machine shouldnt cause your network to be susceptible to ddos attacks

late plank
#

assuming the bot is the only thing you're running and your ip isn't exposed elsewhere

tardy estuary
#

have a separate machine running the bot

late plank
#

for bots ddos attacks aren't the worry, but internet/electric outages are a good enough reason

tardy estuary
#

eh

#

UPS

#

keep you enough uptime probably for power to resume

#

unless you live in an area where outages are very frequent

#

my bot is running on my old pc build because I have absolutely no other use for it. well that and plex

earnest phoenix
#

I really can't decide between lavalink, andesite or ytdl

#

its all frustrating

restive furnace
#

well lavalink, best quality ; ytdl, fastest; andesite, never heard of

earnest phoenix
#

im conflicted now

#

im all abot quality/quantity

#

you can have high quality anywhere lol?

#

lavalink is bloated and java which means a memory hog

#

but it's an easy to use and easy to setup piece of software

restive furnace
#

btw could you (IF6) send me eg. github link of andesite, cause google doesnt seems to find it...

earnest phoenix
#

Hmm... maybe 98-99% of the time
@slender thistle does it come with mysql databases?

#

andesite is archived

#

oh fr

#

which means you get no support for it if you use it

#

so that made the choice 2x easier

#

no wonder the discord server no longer exists

#

with ytdl, if you want to accomplish the level of extensibility lavalink has, you need to be good good at whatever language you're working with

#

you need to learn concepts like real time buffering, rewinding streams etc

#

What is lavalink

#

@earnest phoenix If the url ends with .gif it's a gif. Otherwise you can send an http get request and check that the response mime type is image/gif
@white gyro how to?

#

@earnest phoenix music plugin for discord.js

restive furnace
#

What is lavalink
@earnest phoenix just google

earnest phoenix
#

Anyone use skysilk here?

#

skysilk

restive furnace
#

@earnest phoenix music plugin for discord.js
@earnest phoenix no, for any discord bots

earnest phoenix
#

?

#

oh

#

yea

#

how i edit the color of the role?(11v)

#

did you know why my bot is not working (the error is: invalid token (401 not authorized) but the token is good

#

how i edit the color of the role?(11v)
@earnest phoenix role.color

#

how i use role.color?

restive furnace
#

did you know why my bot is not working (the error is: invalid token (401 not authorized) but the token is good
@earnest phoenix regenerate token

earnest phoenix
#
let role = message.guild.roles.filter(x => x.name === 'Muted').sort((a, b) => a.position - b.position).first();
role.setColor('#FF0000')
#

¿?

restive furnace
#

yes

earnest phoenix
#

ty

#

How do I get the number of people who have a role?

#

check the docs

restive furnace
#

.size on Maps, .length on Arrays, but ^^

earnest phoenix
#

@restive furnace I have regenerate the token but the token are invalid 😦

#

then you're using the wrong token

vestal sequoia
#

Anyone use Java?

earnest phoenix
#

make sure it's actually the token and not the secret

#

is not the secret @earnest phoenix

#

are you reading the token from a file or something

#

token of my bot (discord dev portal)

#

what

quartz kindle
#

how do you use the token in your code?

#

show the code that uses it

#

(without the token)

earnest phoenix
#

more or is good ?

vestal sequoia
#

No one uses Java? 😦

copper cradle
earnest phoenix
#

How can I check if a member == bot?

quartz kindle
#

did you save the file after you copied the token from the dev portal?

copper cradle
#

@earnest phoenix is that the same token that shows in the dev portal?

#

I can't type today ffs

earnest phoenix
#

yes @copper cradle and @quartz kindle is save the file and i save with npm i --save discord.js

quartz kindle
#

i mean save the file that is open in your code editor

copper cradle
#

??

quartz kindle
#

ctrl+S

copper cradle
#

that's not what we mean by save tho

vestal sequoia
#

Ok zSnails

earnest phoenix
#

@quartz kindle i have save the file with ctrl + S

quartz kindle
#

and still the same error? try running it again

heavy marsh
#

I am trying to post a message on member bans using audit logs but something it doesnt post so I want it to search for more logs as bots do so many things

    const fetchedLogs = await guild.fetchAuditLogs({
        limit: 20,
        type: 'MEMBER_BAN_ADD',
    });

Will this work then?

copper cradle
#

@earnest phoenix is the token you have in your client.login() the same as you have in your developer portal?

#

just answer, yes or no

earnest phoenix
#

yes my token is good @copper cradle yes

copper cradle
#

what error are you getting

#

what's your native language?

#

if it's spanish I can help you in spanish

earnest phoenix
#

no french i use node , discord.js , my error is: (node:16704) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided. at WebSocketManager.connect (C:\Users\KingCow\Desktop\bot spam\node_modules\discord.js\src\client\websocket\WebSocketManager.js:135:26) at Client.login (C:\Users\KingCow\Desktop\bot spam\node_modules\discord.js\src\client\Client.js:221:21) (node:16704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:16704) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

heavy marsh
#

[TOKEN_INVALID]: An invalid token was provided.

copper cradle
#

^ read my friend

#

you're passing in an invalid token

#

go to the dev portal

#

copy the token

#

and paste it in your client.login()

heavy marsh
#

May be your are using an invalid token some where else

earnest phoenix
#

yes @heavy marsh but is the good token

copper cradle
#

it isn't

#

if it's erroring then it isn't

#

holy cow

late plank
#

I'm going to guess you copied the client id or something

sudden geyser
#

Are you using the client token, or the bot token?

earnest phoenix
#

bot token

heavy marsh
#

May be your token has been regenerated

sudden geyser
#

Did you click on the "Bot" tab and press "Copy Token"

copper cradle
#

go to the bot tab

#

and yes

#

press copy token

earnest phoenix
#

how do i pass only one var to a function like f(a = 1, b = 2, c = 3) ??? something like f(b = 12)

copper cradle
#

then replace your old token with that token

earnest phoenix
#

I just regenerated the token i have past and stick it and always the same error

copper cradle
#

what lang zerp

earnest phoenix
#

node js, sorry

quartz kindle
#

@earnest phoenix if you want, you can DM me your token, i can test it

heavy marsh
late plank
#

@earnest phoenix do not do that

copper cradle
#

@earnest phoenix you just pass in the thing

late plank
#

do not message him your token

copper cradle
#

Headline

#

tim is trusted

#

don't worry

quartz kindle
#

@late plank i've tested other people's tokens before here, people know me

copper cradle
#

he isn't a bad person

earnest phoenix
#

but how does it know if i want to pass a value into b and not a?

late plank
#

I still wouldn't

neat ingot
#

lol

copper cradle
#

nope

#

function params in js have to be passed in in the order you want them

#

for example

earnest phoenix
#

ok but my bot is on some server lol but no problem if you can save my prob

neat ingot
#

'send me your token, i wont do anything suspisicous with it ~ i promise, people in this internet chat room anyone can join know me!' 😄

#

classic

late plank
#

^^^^^^^^^

quartz kindle
#

lmao

copper cradle
#

...

#

guys

#

you don't know tim lmao

late plank
#

neither does she

neat ingot
#

yea tbh i'd send tim my token

#

can easily be refreshed anyway

slender thistle
#

Tim's trustworthy blobshrug

earnest phoenix
#

there's no work around? if i only want to pass one value and let the rest of them go to default???

quartz kindle
#

you are right for being suspicious, but my reputation speaks for itself

#

if you dont trust, dont send

copper cradle
#

@earnest phoenix no

#

that's why optional values must be at the end

#

so that people can pass the required values first

earnest phoenix
#

is a certified

#

I will give him my confidence anyway the bot is down for the moment

heavy anchor
copper cradle
#

or you can pass in an object

quartz kindle
#

Lol

neat ingot
#

lool

copper cradle
#

and destructure it inside of the function

quartz kindle
#

i need to go out more :(

neat ingot
#

nah, dont do it, the corona's out there!

earnest phoenix
#

does lavalink require shards?

copper cradle
#

something like

function a ({a, b}) {
  return b;
}

a({a: 1});
heavy marsh
earnest phoenix
#

lavalink doesn't care about your bot

#

bruh

copper cradle
#

lavalink isn't what people think it is

earnest phoenix
#

only your connection to the voice channel is controlled by lavalink

#

hmm

neat ingot
#

anyone got a better way to get a time based on players timezone?

#

(my players can set their timezone)

copper cradle
#

just use new Date() and then use the toLocaleTimeString() method or the toLocaleDateString()

#

but the problem is

neat ingot
#

on my server that wouldnt work tho?

#

it'd just return servers local time

tardy estuary
#

it'

copper cradle
#

that's what I was gonna say lol

tardy estuary
#

hmm

copper cradle
#

dekita I think we use the same theme

#

holy cow

tardy estuary
#

cant you pass in a epoch to date?

copper cradle
#

lemme check real quick

neat ingot
#

that strange moment code above is the only way i got it to work lol

#

material theme vs code?

tardy estuary
#

you guys should install synthwave 84 for vscode

#

and call it a day

neat ingot
#

Community Material Theme Darker High Contrast

tardy estuary
#

🙂

neat ingot
#

all the other ways i tried wouldnt take DST into account and kept giving me time an hour off :/

#

whats synthwave for?

copper cradle
#

no we don't

neat ingot
#

omfg no

tardy estuary
#

its a theme

#

a sexi theme

neat ingot
#

that theme needs to die asap

tardy estuary
#

you can even make your syntax glow

#

WHAT

neat ingot
#

burning my retinas fml

#

lol

tardy estuary
#

turn down your brightness

neat ingot
#

just ~ ouch

#

lol

tardy estuary
#

yesssssssss

#

keep it

quartz kindle
#

lmao

tardy estuary
#

do it do it

quartz kindle
#

install powermode

neat ingot
#

...

#

ok that sounds interesting

tardy estuary
#

bahah

#

dude

#

installing immediately

neat ingot
#

do i need to supply sounds or does it have a default bank?

quartz kindle
#

idk if it has sounds, never used it because i use sublimetext

#

but it works best on Atom

#

all other code editors had trouble porting it lmao

neat ingot
#

oh, the only vs code thing is 'power mode sounds', which makes a sound each time you hit a key

#

lol

tardy estuary
quartz kindle
#

oo glow is sexy

tardy estuary
#

XD

quartz kindle
#

tbh i kinda want to switch to Atom just because of powermode

tardy estuary
#

then put on synthwave music

quartz kindle
heavy anchor
#

lol

tardy estuary
#

ah atoms is better

#

cause the entire window shakes

#

rather than the text

quartz kindle
#

yeah, Atom has more interface hooks

copper fog
quartz kindle
#

gives more control to extensions and addons

neat ingot
tardy estuary
#

since were on the topic of things like this

neat ingot
#

thats way too vivid to be using regularly lol

tardy estuary
#

this is my all time favorite font

#

haha yeah its gimmicky to the max

copper cradle
#

lmao

#

I need power mode

quartz kindle
#

@tardy estuary i wouldnt understand my code at all if i used that lmao

tardy estuary
#

haha it takes slight getting used to

#

but i think their argument is valid

neat ingot
tardy estuary
#

fonts should be designed with those unicode symbols in the future

neat ingot
#

excellent, just what i always wanted

tardy estuary
#

haha yeah just disable it and it goes away

#

vscode does some integrity checks and I think it messes with a file. but disabling the glow takes it back to normal

neat ingot
#

lol, already completely uninstalled synthwave 😄

tardy estuary
#

boooooo

neat ingot
#

tbh

#

i really miss the theme i had in sublime text

earnest phoenix
#

anyone know how i could loop through this document and change all string "true" and "false"'s to boolean true and falses

#

using js

copper cradle
#

regexp

#

send that code as text

#

and I'll make a regexp to match them

earnest phoenix
#

you asking me?

copper cradle
#

yes

#

send that object as text here

earnest phoenix
#
{
  _id: 5e7af68a263b0f0004b491dc,
  Type: 'Modules',
  partys: 'True',
  Bans: 'True',
  Mutes: 'True',
  Music: 'True',
  XP: 'True',
  Ai: 'false',
  Msglogs: 'True',
  Guilds: 'True',
  Announce: 'True',
  DevTracker: 'false',
  Welcome: 'True',
  GuildId: '584582283730747403',
  ShadowandSummer: 'false',
  Eclipse: 'false',
  LevelMsgs: 'True',
  __v: 0,
  CleanerMusicMessages: true
}
neat ingot
#
Object.keys(theobjecthere).forEach(key => {
    const value = theobjecthere[key];
    if (['True', 'False'].indexOf(value)>=0){
        theobjecthere[key] = Boolean(value);
    }
});
#

regexp could probly do it too, always many ways to do a thing

earnest phoenix
#

oh theres keys and values in js

#

i'll just do that

neat ingot
#

yea, js objects are key value pairs

copper cradle
#

well I mean

neat ingot
#

just, the value is commonly another object

earnest phoenix
#

ok thanks ❤️

neat ingot
#

question, why are you storing them as strings anyway?

#

i can see some have camel case as well, which is inconsistent

#

probably best to do value.toLowerCase() when converting into boolean, idk how it would respond with camel case, probly fine, but idk

#

ahh yea, it works fine with camel case, no need for the toLowerCase() 🙂

copper cradle
#

it doesn't care about it

neat ingot
#

lol yea just checked in browser console 😄

copper cradle
#

lul

#

I check in discord's console 😎

earnest phoenix
#

it was a dumb thing that i done a while ago lmao

quartz kindle
#

you cant use Boolean for that

neat ingot
#

also, it seems your using mondodb/mongoose? @earnest phoenix

quartz kindle
earnest phoenix
#

only now just fixing it

#

mongoose

neat ingot
#

😮

#

wth

copper cradle
#

it doesn't parse them as bools

#

remember

quartz kindle
#

because its a non-empty string, which is truthy

tardy estuary
#

anything other than undefined, 0 would be true in js

copper cradle
#

truthy and falsy

tardy estuary
#

and prob something else

#

yeh

copper cradle
#

yeah

neat ingot
#

fml learn something every day 😄

copper cradle
#

just replace them I mean

earnest phoenix
copper cradle
#

loop through them

#

or use a regexp

#

but that'd take extra work

#

bc you'd have to turn the obj into a string and then back into an obj

#

unless the obj is in another file

#

which I don't think so

neat ingot
#

/false|true/i.test("tRuE")

#

some regexp to check if its true then 😄

#

tbf, that also returns true if its 'false'

#

but can easily be altered

quartz kindle
#

Interestingly

#

you can do this

#

but it has to be lowercase

#

lmao

neat ingot
#

oohh, fancy

copper cradle
#

a quick .toLowerCase() will fix that

quartz kindle
#

yeah

#

but its probably way more expensive than to simply do value.toLowerCase() === "true" ? true : false

neat ingot
#
theobjecthere[key] = /true/i.test(value);
// OR
theobjecthere[key] = JSON.parse(value.toLowerCase());
copper cradle
#

yeah

#

a quick ternary will do the job

#

but I don't think most people here care about performance tbf

earnest phoenix
#

how can i loop through every element in the doc and change the value then

#

bc ```js
Object.keys(Doc).forEach(key => {
const value = Doc[key];
if (['True', 'False'].indexOf(value)){
Doc[key] = Boolean(value);
}
});

That doesnt work lul
copper cradle
#

._:|

neat ingot
#

why dont you have mongoose using booleans by default?

earnest phoenix
#

dont even ask about it lmao

neat ingot
#

no, cause i edited after that to have >=0 in the if statement after indexOf

#

Object.keys(theobjecthere).forEach(key => {
    const value = theobjecthere[key];
    if (['True', 'False'].indexOf(value)>=0){
        theobjecthere[key] = /true/i.test(value);
        // OR
        theobjecthere[key] = JSON.parse(value.toLowerCase());
    }
});
#
Object.keys(theobjecthere).forEach(key => {
    const value = theobjecthere[key];
    theobjecthere[key] = value.toLowerCase() === 'true';
});
#

^ as suggested above for performance reasons

quartz kindle
#

indexOf returns the position in the string, -1 if not found or 0+ if found (for example 5 if the result starts in the 6th character in the string)

#

so you need to check if the result of indexOf is not -1

neat ingot
#

^

glass crag
#

Can I access the shard id from the inside the shard itself?

#

I want to only process some code on one instance

split hazel
#

All shard objects should have a id prop

amber fractal
#

not on v12

#

wait

#

how do you even get the shard

#

because client.shard returns a shardclientutil

humble vessel
#

ah I see okay.

#

I'm new to bot development, I normally do applications and data analysis, so the discord design elements are new to me.

#

I'm wondering what I should research when it comes to the fancier boxes and such that display in response.

neat ingot
#

'embeds'

humble vessel
#

How does that work?

neat ingot
#

^ an embed

humble vessel
#

Yes those

neat ingot
humble vessel
#

Oh i see

neat ingot
#

the embeds have a specific format for how it shows the data, but creating them is fairly easy

humble vessel
#

I write mostly in python is it possible to do in python or do I need to switch to javascript?

sonic lodge
#

definitely possible

#

what library

neat ingot
#

^ discord.js guide for embeds

slender thistle
neat ingot
#

never used it personally

humble vessel
#

I've been developing using it for a few days now

#

I have three bots running right now, but I didn't know what to search to figure out what I now know is called an embed

sonic lodge
#

this will probably be of use

copper cradle
#

@humble vessel what kind of question is that

#

you just need a library to interact with the discord api

#

and that's it

#

it's up to the library to implement such thing tho

humble vessel
#

That was the question.

#

Does the .py library implement embeds

#

or would I need to switch to javascript

copper cradle
#

yes

humble vessel
#

I now know that thank you.

sonic lodge
#

see the link above @humble vessel

copper cradle
#

you don't need to switch to another lang if a lib doesn't have something

#

you can implement it yourself

#

bruh

humble vessel
#

lower level implementation in python is awful. Cite tkinter. I was only writing these bots in python because it's quick.

copper cradle
#

lol

#

an embed is just an object

humble vessel
#

If it didnt work in python, I was going to switch to JS because JS has an implementation.

copper cradle
#

you can send a raw object to the api and that's be an embed

#

ofc you need to know the keys they use

#

js doesn't

#

discord.js has one

#

discord.js is a library

humble vessel
#

the use of discord.js is implied.

copper cradle
#

nice

neat ingot
#

tbh i'd switch to js

#

but i dislike python

copper cradle
#

no

neat ingot
#

😄

copper cradle
#

python is good

#

besides from the gay ass indentation shit python is very good

humble vessel
#

Python can do anything... very slowly...

copper cradle
#

golang is way faster than python

sudden geyser
#

languages are just tools

humble vessel
#

I actually havent looked much into golang

copper cradle
#

well

neat ingot
#

wonder if there is discord c lib, there must be right?

copper cradle
#

golang has a very nice syntax

#

well

#

idk

sudden geyser
#

probably is if you scroll around github

copper cradle
#

yeah

slender thistle
#

Python is mostly used as a language for working with data

copper cradle
#

I'll check

neat ingot
#

python is more machine learning nowadays i think

#

they all seem to use py for it

slender thistle
#

Pretty much

humble vessel
#

meh

slender thistle
#

I personally use Python for working with my calculations because it's convenient blobshrug

humble vessel
#

Python machine learning can struggle a bit

neat ingot
#

try js ml...

copper cradle
#

I use python for my math class lmao

slender thistle
#

Same

humble vessel
#

a lot of numpy is precompiled C so its fast, but then look at matplotlib and its awful

neat ingot
#

i used brain.js to build a neural network that predicts where the ball will end up - for the ai in a dumb pong game i made a few years back

slender thistle
#

matplotlib is quite slow, I've noticed that bahahaha

copper cradle
#

I like how python has these pyc files

humble vessel
#

so a lot of the neural networks work well in python, but data output via matplotlib is awful

copper cradle
#

which just make it faster to run

#

not the first time

slender thistle
#

Took maybe 4-5 seconds to run a script that created about 8 subplots with 2 points in each

humble vessel
#

also python doesn't use programmer implemented pointers which makes things easier to implement in python because theres a standard behavior and not much pointer math.

#

Oh yeah now try saving them

#

@ imagemagick

slender thistle
copper cradle
#

lol ye

late plank
copper cradle
#

yeah

late plank
#

Who's the best point of contact for that

copper cradle
#

¯_(ツ)_/¯

#

your internet provider probably

amber fractal
#

it's known

copper cradle
#

or their host

#

but they're currently having problems

amber fractal
#

top.gg has been a little slow recently

copper cradle
#

so there's no fix we can do

late plank
#

17000ms is not "a little slow"

#

that's more indicative of something being on fire back there lol

neat ingot
#

tbh its been slow for the past week or two

#

probably getting ddos'd by some bored nub kids

amber fractal
#

they definitely have ddos protection...

neat ingot
#

now...

amber fractal
#

considering they have cloudflare

neat ingot
#

up until a week or so ago i had never seen their ddos protection when loading the page

copper cradle
#

yeah

neat ingot
#

which suggests to me its a new addition

#

which suggests they have been under attack and needed the protection

copper cradle
#

sO yOu WeRe DdOsInG tHeM hUh

neat ingot
#

all speculation ofc

amber fractal
#

the thing you get from cloudflare is toggleable

digital ibex
#

hi

#

with eris, how can i change [TextChannel 689243480266244200] to just the id?

sudden geyser
#

The DDoS Production message has been here for a while (toggleable/not always here).

quartz kindle
#

@digital ibex how did you get that value?

digital ibex
#

through a channel resolver

#

message.channel.guild.channels.find((e) => e.name === args[1]);

quartz kindle
#

then its a channel object

#

you can just .id

digital ibex
#

yeah, i done that but it still shows as [text channel...

#

oh, i forgot to refresh on mongo compass mb

copper cradle
#

lmao

earnest phoenix
#

dunno how I would use lavalink on heroku

pale vessel
#

bad though

#

don't use it for production

#

it's for testing

#

it'll sleep

copper cradle
#

don't 👏 use 👏 heroku

pale vessel
#

^

digital ibex
#

or glitch for discord bots

earnest phoenix
#

heroku can't even handle running a lavalink server and a bot concurrently

#

lol

#

if someone dies from childbirth can you press charges on the baby

#

neither can glitch

neat ingot
#

heroku is ok for websites that dont get much traffic, but thats about it imo

pale vessel
#

wrong way?

earnest phoenix
#

wtf discord

#

i press a space to find the up emoji and it instead acts as if i pressed enter?

#

what's a good way to return both hm and msg?

function parseTime(string){

  let msg = ""

  let hm = string.slice(0,5).split(':');

  msg += string.slice(6)
  
  console.log("formated time:", hm, "optional message:", msg)
}
copper cradle
#

you forgot the ending ```

earnest phoenix
#

return an object

copper cradle
#

yeah

#

if js was like go where you can return multiple values 😔

#

I'd love being able to do that

#

instead of using gay ass callbacks

earnest phoenix
#

if only js had tuples

#

it makes sense it doesn't though

#

it isn't typed

#

there's a prob a module for it

copper cradle
#

yeah

#

zerp

#

what are you saying

#

a package that can implement new syntax

#

where

earnest phoenix
#

you're in the wrong channel

#

its important yall watch this

copper cradle
#

wrong channel tho

neat ingot
amber fractal
earnest phoenix
#

nah this is development related i think

neat ingot
#

lol

pale vessel
#

oh

#

it is

copper cradle
#

now uber gets uncert

earnest phoenix
#

h yes illegal anime girls are my favourite part of development

#

i mean what

pale vessel
#

yes you two years ago

earnest phoenix
#

yea my keyboard was just fucking up

pale peak
#

I need help if anyone can help me

#

@earnest phoenix

earnest phoenix
#

yo

pale vessel
#

bruh don't ask to ask

#

wasting time pepega

copper cradle
toxic jolt
#

help me please

#

ERROR: (node:124) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of undefined

copper cradle
#

args[1] is undefined

toxic jolt
#
      //end of create role
  let behle = args[1]
  .replace(`sn`, `s`)
  .replace(`dk`, `m`)
  .replace(`sa`, `h`)
  .replace(`g`, `d`)

  if(!behle) return message.reply(`:warning: Lütfen bir zaman giriniz! \n**Doğru Kullanım;** \`!!pretestyap sn/dk/sa/g\``)
copper cradle
#

duh

neat ingot
#

your trying to replace a string, args[1], which hasnt been given.

quartz kindle
#

console.log(args) to see what it actually contains

toxic jolt
#

okay

copper cradle
#

I bet they think args[1] is the first element

toxic jolt
#

i trying now

copper cradle
#

dude this isn't lua

tardy estuary
#

heh

toxic jolt
#
const db = require('quick.db')
//const ms = require('parse-ms')
const ms = require("ms");
const Discord = require('discord.js')




exports.run = async (client, message, args) => {
//let behle = await db.fetch(`presuresi_${message.guild.id}`) // 24 SAAT: 8.64e+7 / gibi.
//let behle = 
// 900000000  9 saat
let user = message.author
let sure = await db.fetch(`prezaman12_${message.guild.id}`)
        //end of create role
  let behle = args[0]
  .replace(`sn`, `s`)
  .replace(`dk`, `m`)
  .replace(`sa`, `h`)
  .replace(`g`, `d`)
if(args[0]) return message.reply(`:warning: Lütfen bir zaman giriniz! \n**Doğru Kullanım;** \`!!pretestyap sn/dk/sa/g\``)

  console.log(args)
      //if (sure !== null && behle - (Date.now() - sure) > 0) {
      let timeObj = ms(behle - (Date.now() - sure))
      message.channel.send(`> Tebrikler Premium kazandın! \n > Şuan da **${timeObj.hours} saat ${timeObj.minutes} dakika** premiumun var!`)
         
        
        db.set(`presuresi1_${message.guild.id}`, behle);
        db.set(`prezaman12_${message.guild.id}`, Date.now());
    //  } 
  
  }

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

exports.help = {
  name: 'pretestyap', 
  description: "Sunucuya eklenen botu onaylar.",
  usage: 'botonayla <bot ismi>'
};```
#

its my command.

#

I am trying to make a timed premium.

quartz kindle
#

like i said, check your args

copper cradle
#

dude

#

console.log(args) before the line where the error happens

#

ffs

#

or else that code will never get executed

toxic jolt
#

hmm

copper cradle
#

and then show the output

toxic jolt
#

😄

#

omg thanks

#

😄

#

thanks teacher

copper cradle
#

that won't fix your error

#

but that will tell us what's inside args

toxic jolt
quartz kindle
toxic jolt
#

here

quartz kindle
#

args is empty

toxic jolt
#

oh

#

wait

copper cradle
#

when you run the command on discord

#

how do you run it?

toxic jolt
copper cradle
#

how did you define args

#

well then?

#

it's working as far as I can see

toxic jolt
copper cradle
#

I don't speak that language so I don't know if it worked or it didn't

toxic jolt
#

wait i translate this command

#
const db = require('quick.db')
//const ms = require('parse-ms')
const ms = require("ms");
const Discord = require('discord.js')



exports.run = async (client, message, args) => {
let user = message.author
let time = await db.fetch(`pretimenow_${message.guild.id}`)
        
console.log(args)
  let wait = args[0]
  .replace(`sn`, `s`) // turkish time / sn / dk / sa / g . bla bla.
  .replace(`dk`, `m`)
  .replace(`sa`, `h`)
  .replace(`g`, `d`)
if(!wait) return message.reply(`:warning: Please write time!\n**Its true;** \`!!pre-make-this-user sn/dk/sa/g\``)

  
      //if (sure !== null && behle - (Date.now() - sure) > 0) {
      let timeObj = ms(wait - (Date.now() - time))
      message.channel.send(`> You wounded premium! \n > Your premium time: **${timeObj.hours} hour ${timeObj.minutes} minitues**!`)
         
        
        db.set(`pretime_${message.guild.id}`, wait);
        db.set(`prenowtime_${message.guild.id}`, Date.now());
    //  } 
  
  }

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

exports.help = {
  name: 'pre-make-this-user', 
  description: "Blabla.",
  usage: 'pre-make-this-user'
};```
#

i translated.

#

@copper cradle

earnest phoenix
#

Change this if(!behle)

neat ingot
#

i really dislike that framework, idk which one it is, but it has the

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

exports.help = {
  name: 'pre-make-this-user', 
  description: "Blabla.",
  usage: 'pre-make-this-user'
};```
^ cant be dealing with that
#

lol

toxic jolt
#

😄

copper cradle
#

@neat ingot It's called the youtube tutorial framework

neat ingot
#

ha

copper cradle
#

change that yeah

#

brb

toxic jolt
#

i how fix now

neat ingot
#

what are you trying to do pudo?

toxic jolt
#

hmm

#

I am trying to make a timed premium.

#

5 day trailer or 10 day

#

bla bla

neat ingot
#

ahhh, so a user can become a premium member, this command does what though? tell you how long you have left premium?

toxic jolt
#

This command sets the time in the (wait) field. I'll do it as a code, but I have to fix this.

neat ingot
#

yea, if an argument hasnt been provided that will throw an error

toxic jolt
#

OMG

neat ingot
#
    if (!!args[0]) {
        return message.reply(`:warning: Please give argument!`)
    }
amber fractal
#

why double !

neat ingot
#

😉

toxic jolt
neat ingot
#

to check it has content and is not an empty string

#

the ol' "notnot" 😄

#

oh

#

lol

zenith orchid
#

Why used two "!"?

neat ingot
#

need to make sure args[0] exists before trying to 'notnot' it