#development

1 messages Β· Page 677 of 1

chrome olive
#

u know web dev?

#

@earnest phoenix

tight heath
#

yes

earnest phoenix
#

Java or HTML?

chrome olive
#

Html (EJS)

earnest phoenix
#

Does the playFile require the mp3 to have a certain bitrate or a certain sample rate?

chrome olive
#

what ....

earnest phoenix
#

Delete your current package.json and self download all the npm packages

quartz kindle
#

also, you're probably using linux's default node version which is 8

#

you can use NVM to install a more current node version like v10 or v12

earnest phoenix
#

If you do n 12.6.0 it should update but I may be wrong

#

how to make xp bar?

#

elaborate

#

is there a certain package i have to install

#

xp bar

#

what

#

where

unique nimbus
#

what do you mean by an xp bar?

earnest phoenix
#

progress bar

#

but where

#

no one can read your mind, describe it

unique nimbus
#

what

earnest phoenix
#

with canvas

#

say i have like 75XP / 100 XP it covers 3/4 of the bar

#

Canvas @earnest phoenix

#

canvas-constructor

#

?

#

Yes

unique nimbus
#

yes

earnest phoenix
#

ok

unique nimbus
#

or Pillow in python

earnest phoenix
#

Add a shape and divide the size of the shape by the amount of xp

#

Or something like that

#

i dont remember

unique nimbus
#

Turn the maximum needed and current xp into a percentage and make a length for it

#

idfk

earnest phoenix
#

calculate the percentage of completed xp and then cover that amount of percentage in the width of your xp bar

#

hm

#

It's not easy

unique nimbus
#

canvas and pillow isnt easy to do

#

ngl

earnest phoenix
#

But it's not long to do

abstract crow
#

So what code editor do you guys choose any why. For those Atom/VSCode guys, why did you choose that one over the other?

earnest phoenix
#

Sublime Text is good

#

Simple, quick launch, clear design

#

sublime lacks features outside of basic web editing

abstract crow
#

That I agree with

valid frigate
#

webstorm because its free with github student pack or something

mossy vine
#

vim. takes a bit to set up, but is awesome afterwards

abstract crow
#

I use VSCode because of the built in terminal, but there are so many popups and different things that it just makes it confusing at times.

#

@valid frigate Exactly why I asked. I just got approved overnight

valid frigate
#

oh ok

#

its up to you really

abstract crow
#

I just don't like the dark grey and orange IDE color

valid frigate
#

yeah me neither

#

probably the only thing that keeps me in webstorm rn is just better code completion

#

other than that it's like a memory hog

abstract crow
#

Ah gotcha

#

And by code completion you mean like an intellisense type of thing right?

valid frigate
#

yeah

#

i use typescript and it's a lot better at it lmao

abstract crow
#

I mean I like VSCode's but I need plugins galore

valid frigate
#

yeah ws has plugins but they're like rare

#

i think ws is lucky that a discord rpc plugin exists

abstract crow
#

Ah yeah

#

That is a killer for me 🀣

valid frigate
#

lul

abstract crow
#

I just like having it lol

valid frigate
#

vanilla ws is pretty good overall tho

abstract crow
#

Got me a staff position in a community.
"Hey I see you code JS, what do you do?"
Hours later: "Alright here is your email, just respond back if you agree"

valid frigate
#

lmao nice

#

ive been coding solo for like 5 years, not one collaborator spongerino

west spoke
#

F

abstract crow
#

jeez

valid frigate
#

anyways yeah id say vs code is good for lightweight stuff

mossy vine
#

instead of having a terminal in your editor, how about having your editor in the terminal yknow

abstract crow
#

I mean I have been coding for 1 year and no one to collab with until recently, but that project is away right now. I usually just code for myself or make something for someone

valid frigate
#

use ws for larger projects since when you rename a class, it automatically renames it across your entire project

#

oh F

#

i have like 20 repos dating back to 2015 ish and tony was the only one to make a fork lmao

west spoke
#

@abstract crow hey there could you check #general for a sec, or say sa :p

abstract crow
#

sa

earnest phoenix
#

Alright I updated my node, ffmpeg is now installed, but the same problem happens, bot joins, nothing plays

#

any ideas?

mossy vine
#

code?

valid frigate
#

is your bot running on windows or linux

twilit rapids
#

@earnest phoenix please give us more information, what is your code? What are the errors?

earnest phoenix
#

It doesn't output an error that's the thing

#

It just joins and doens't play

#
                if(!(bot.guilds.find(g => g.id === message.guild.id).channels.find(c => c.id === vcChannel).members.has(bot.guilds.find(g => g.id === message.guild.id).me)==true)) {
                        bot.guilds.find(g => g.id === message.guild.id).channels.find(c => c.id === vcChannel).join()
                        .then(connection  => {
                        console.log(`CONNECTION: ${connection}`);
                        const dispatcher = connection.playFile("./sounds/FlatSong.mp3", {seek: 0, volume: 1.0, passes: 4, bitrate: "auto"} ); 
                        connection.on('error', console.error)
                        dispatcher.on('error', console.error)
                        })
                        .catch(console.error);
                } else {console.log(`ALREADY IN ${vcChannel}`);}
#

Here's the code I've put

valid frigate
#

ok so assuming you're on stable

earnest phoenix
#

11.5.1 yes

valid frigate
#

uh

#

is the console printing anything that might be relevant to the problem lo

earnest phoenix
#

That's all that it says

#

Connection [object Object]

valid frigate
#

basically you're logging the entire connection object

#

that means its connected but the music isnt playing

earnest phoenix
#

yes that's what I experience too

valid frigate
#

so i would assume its cuz ffmpeg isnt set up correctly

earnest phoenix
#

alright I literally just installed ffmpeg about 20 minutes ago on this machine

valid frigate
#

is it linux or windows

earnest phoenix
#

linux

valid frigate
#

well Thonk

twilit rapids
#

1). That code wants to make me wash my eyes with soap
2). Why are you searching for a channel while you can just use <Message>.member.voiceChannel()
3). How exactly did you install FFMPEG

earnest phoenix
#

sudo yum install ffmpeg

valid frigate
#

well to be fair although your code needs tidying, it should be playing something

#

did you install djs with voice support (node-opus)

twilit rapids
#

Try changing the PATH of the file to the full PATH e.g. 'C:/Users/Discord/Desktop/music.mp3'

#

Then try again

valid frigate
#

if you ran your node script from the bots directory and you have a dir named sounds in it, it should work yeah

twilit rapids
#

And make sure you have either opusscript or node-opus installed what Vysion mentioned

valid frigate
#

ew opusscript

#

bruv

twilit rapids
#

either

#

Both work

valid frigate
#

yeah both work

#

but still

twilit rapids
#

opusscript uses less resources and is more commonly used for bigger bots

inner jewel
#

bigger bots just use lavaplayer

twilit rapids
#

You just broke my point why opusscript has one advantage

#

Also when are you going to accept my friend request

valid frigate
#

lavaplayer has clients for a lot of libs doesnt it

earnest phoenix
#

wat

#

lavaplayer is not lavalink

twilit rapids
#

no

woven delta
#

hi! i'm really new here, nie to meet you all, you can call me Madeleine
I was wondering how to get started with uploading a bot??
as you can probably tell I've never uploaded one before
I've had some experience with yagpdb in my own server but that's about it
also is this the right place to post this?? πŸ˜“

mossy vine
#

it is, but it doesnt really work like that

woven delta
#

what do you mean?? @mossy vine

mossy vine
#

you dont "upload" a bot

woven delta
#

oh?

mossy vine
#

first of all, do you know any programming languages?

woven delta
#

well, yano, add one

#

uhh not really

#

u mean like Python n stuff

#

I guess I know a little

mossy vine
#

you make a bot by writing code for it

woven delta
#

oof I must sound so stupid xd

#

yeah, I know

#

but how to, I don't know 😩

mossy vine
#

its not really an easy project. you need to he quite familiar with the language of your choosing before you can start

woven delta
#

oh, ok

mossy vine
#

well, you dont have to be, but it helps soooo much

woven delta
#

which one is the easiest to get started with?

#

yeah, that makes sense πŸ˜…

mossy vine
#

python and javascript are the easiest and more popular ones

woven delta
#

ok

mossy vine
#

most*

west spoke
#

Python would be easiest

woven delta
#

@west spoke where do I put all this stuff??

#

and how to get started??

#

coding fascinates me

mossy vine
#

look up some guides online

woven delta
#

do you guys have any advice πŸ˜…

trail dagger
#

to what?

mossy vine
#

yeah, dont jump into bot development before understanding the language properly

west spoke
#

you should work on a simple game in the lang

#

That's what I started out with

#

then decided to fuck myself by making a graphing calculator

trail dagger
#

I started with python at school 😏

woven delta
#

oh yeah

#

I have absolutely no idea how to use that

#

like ive heard of it, definitely

#

but where do I even put this

west spoke
#

python?

trail dagger
#

if you cant use python you shouldnt jump into any other language

woven delta
#

in the add bot page it doesn't seem to have a space for the code

trail dagger
#

python is the easiest coding laguage

west spoke
#

you dont put it there

woven delta
#

oh

west spoke
#

you code it in a host

woven delta
#

NOW IM REALLY CONFUSED o_O

mossy vine
#

you write a script that interacts with the discord api, usually with the help of a library like discord.py

west spoke
trail dagger
woven delta
#

@trail dagger thank you! :)

#

and @west spoke

#

and @mossy vine

#

still no idea what im supposed to do

trail dagger
#

Lazy, what are you working on in that pic?

west spoke
#

That was a failed on_vote event

trail dagger
#

Ah, i almost got like vote lock, but everytime someone used the command without voting the bot crashed πŸ˜–

west spoke
#

what lang?

trail dagger
#

python

west spoke
#

What happened to it?

#

I could help

trail dagger
#

It crashed the bot lol

west spoke
#

Any errors?

trail dagger
#

nope

west spoke
#

Weird

trail dagger
#

it just wanted to crash

west spoke
#

you didnt put sys.exit() in it did you?

trail dagger
#

nope

#

didnt use sys at all

west spoke
#

Shoot me your code in dm, excluding sensitive things

trail dagger
#

i gave up vote lock for a while ago and deleted the code but i was planning on remaking it later

west spoke
#

Ah

#

Well I can give you what I did

#

if you want

trail dagger
#

sure

slender thistle
#

If your bot crashes unintentionally with just one command, surely there's something wrong

west spoke
#

^

trail dagger
#

yupp

#

something was wrong, but i was tierd and just wanted to sleep

#

and know i am going back to school on monday, so i want to focus on that for a while, but the first week is just the stupid adults playing around

warm marsh
#

On the dbl page can I use my website inside an iframe for the long desc or do I still need to add 300 words?

abstract crow
#

Would anyone know how I can get the console to log the error whenever it happens? Sentry does it, but my console won't

warm marsh
#

Alright, Thanks!

slim heart
#

realistically, whats the best way of going about doing updates every x amount of time, or at x time everyday? Im pretty sure (tell me if im wrong) rate limiting isnt an issue since itll be to a different channel of course for each guild but im worried about it being classified as spam? maybe not, just want some advice on doing something like this.

valid frigate
#

bot updates or updates you want your bot to run (e.g. economy) every x seconds?

slim heart
#

im doing a weather bot and a commonly asked for feature is to post weather every x amount of time, which im probably gonna do every day or maybe a time based for patrons but yeah

abstract crow
#

i broke webstorm

#

i can't do anything

valid frigate
#

lmfao how

abstract crow
#

my console broke it

#

I was trying to debug

#

and I got it right... Its just I kinda console.log(client.guilds.get(id))

#

OH SHIT THAT IS 60k users

valid frigate
#

doesnt client.guilds.get(id) return [object promise]

abstract crow
#

idk maybe

valid frigate
#

normally it won't crash if it outputs an [object x] thing

abstract crow
#

something like that tho i did

valid frigate
#

if you log every user in it maybe lmao

abstract crow
#

GOOGLE CHROME IS BEATING IT LOL

#

So webstorm isn't as bad as GC

valid frigate
#

google chrome is consumer of memory

#

yeah actually ws isn't that bad

#

like it has a cap of 725mb per window

abstract crow
#

console.log(client.users.size); console.log(rows.rows[rowID].guild_id); console.log(client.guilds.get(rows.rows[rowID].guild_id));

valid frigate
#

for me, it just hovers around 200mb

abstract crow
#

That is what I did

valid frigate
#

wew

#

if it's trying to get a fuck ton of guilds maybe that's why

abstract crow
#

oh shit nodemon never stopped when I forced close webstorm

#

so my ports are still running..

valid frigate
#

smh

abstract crow
#

Yay I got it working

#

I was testing with my dev bot, so I had my dashboard try to find the user via the guild, which my testing bot couldn't find

#

So it was throwing errors, and finally after a few if statements, now if the user is not in that guild or not found it displays that

valid frigate
#

hmm good

abstract crow
valid frigate
#

and also jpbberry, you can't really predict when the api will update the weather which could be like once every .5 seconds, but iirc the discord api message ratelimit is per channel

#

so it's not api abuse if you send a message to x channel every x seconds as long as it's not >1message/second

abstract crow
#

Just run it like every 5 minutes and check for a change, if nothing changed then don't do anything

valid frigate
#

i wonder what the ratelimit is for bots like rythm

earnest phoenix
#

helo, im trying to somehow get time when user does something

#

lets say when user reacts to message

#

can i get how fast user reacts after message has been sent?

scarlet wraith
#

In the website there's a option a vote for the bot once per 12 hours? When does the vote resets? So I can vote for the bots soon after it lets me.

earnest phoenix
#

after 12 hours ..

idle mountain
#

@earnest phoenix reaction timestamp minus message timestamp

scarlet wraith
#

But is it 12 hours after the first vote or is it like every 6AM, 6PM, or every 12AM, and 12PM or something? Sorry, lol πŸ˜‚

abstract crow
#

I think after each vote

earnest phoenix
#

shoud've thonk of that

idle mountain
#

not sure you can get reaction timestamp, actually

#

but you can get current timestamp

#

when a reaction is added

earnest phoenix
#

i'll use nested reaction event instead, shit but works

scarlet wraith
#

Well OK, lol πŸ˜‚

earnest phoenix
#

πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

snow urchin
#
                    const bf = (reaction, user) => reaction.emoji.name === 'πŸ“₯' && user.id !== "480421483575902208";
                            const openT = msg.createReactionCollector(bf);

I have this, and I have openT.on("collect", r => { console.log(r.content)})
but r.content logs undefined
I am trying to get the username and id of the person who reacted

valid frigate
#

r.content isn't defined then

#

unfortunately the djs docs dont give any helpful information on what type of object is collected when the collect event is fired lmao

earnest phoenix
#

createReactionCollector

#

i wonder which type

valid frigate
#

bruv

#

actually

earnest phoenix
#

it's going to be a reaction

valid frigate
#

just try logging what r returns

earnest phoenix
#

because it's collecting reactions

#

the reason it's * is because it extends Collector

valid frigate
#

why is there no typedef for it

earnest phoenix
#

r.content doesn't work because a reaction doesnt have content

snow urchin
#

https://gyazo.com/d773d4021fddd276d19190ad55a19700
Im tryna make that work, but everywhere, that has something about the person opening the ticket, like the user id / username / tag etc, are just left undefined because I have not figured out how to get that info when they react yet, and I need help finding out how I can do it.

earnest phoenix
#

how would i check if a user has voted for a bot

opaque eagle
#
https://discordbots.org/api/bots/{bot's id}/check?userId={user's id}```
#

You need to include your token too, btw

earnest phoenix
#

so i just make an http request and get the contect

mossy fjord
#

Where do I get that code quality badge it gives a letter grading own your code quality I see it on Github all the time.

tight heath
#

click on one of those

round shuttle
#

Are webhooks OK for now? Can't catch one.

twilit rapids
#

What do you mean with "Can't catch one."?

round shuttle
#

Bot didn't recieve webhooks.

mossy vine
#

not even the test webhook?

round shuttle
#

yes

#

That's why I'm asking

mossy vine
#

then you either provided wrong ip and path, or it cant access it

tight heath
#

are you sure it's listening on an open port

#

and you specified the correct IP/path

round shuttle
#

It was OK some hours ago...

tight heath
twilit rapids
#

My webhook is working fine

#

So it's something on your side

round shuttle
#

Did you check just now?

twilit rapids
#

Yes

round shuttle
#

Thanks, will investigate further

twilit rapids
real helm
#

Hello

#

I have a problem

earnest phoenix
#

What?

real helm
#

I was have a problem with a persons...

#

And i delete my bot app

#

And I need that add now there

earnest phoenix
#

@snow urchin Why are you storing strings where integers are supposed to go?

#

And what's the problem you're having?

earnest phoenix
#

when you make embed, and second value in .addField, just use \n, so .addFIeld('asd', 'some text\nanother text')

wet void
#

@earnest phoenix check the documentation for Client, also look into filtering collections (eg of channels, users)

earnest phoenix
#

discords documentation or discordbots ?

#

neither

#

oh from like discord.js ?

#

yes

umbral glacier
#

Discord bot reply message with url of images inside, but why is it not render the images, after message was sent?

tight heath
#

is the message an embed

earnest phoenix
#

@umbral glacier sometimes thumbnails/images in embeds don't display regarding some errors with the url

#

I wonder how Discord's new API will affect the current one

#

I only had my doubts about the new version of discord.js and the deprecation warnings, and now discord api 😭

tight heath
#

I'm not saying there's anything planned

#

but when the time comes that there's a major api change, not updating your wrapper is a bad idea

signal prairie
#

Well my library is still on "^11.5.1" so idk if it needs to update or no

tight heath
#

stable will receive regular updates

#

though imo d.js master (v12) is far superior

signal prairie
#

Yeah my discord.js always stayed at v11 and it never got higher than that

tight heath
#

npm uninstall discord.js && npm install discordjs/discord.js

#

for v12

#

you'll need to rewrite some code tho

#

like

#

example:

#

getMember would become members.get

#

it's just much better stuctured

#

you can have a look at the docs for the changes

earnest phoenix
inner jewel
#

network error

tight heath
#
When you, as a client, send a request to a remote server, and receive no timely response. Your socket is ended which throws this error. You should catch this error and decide how to handle it: whether retry the request, queue it for later, etc.
signal prairie
#

Welp tried to update with the command you said but can't, it says it miss better-sqlite3.node

tight heath
#

not related to d.js

#

you might want to recompile it tho

signal prairie
#

Wym?

#

That better-sqlit3.node needs to be from better-sqlite3 package

tight heath
#

yes

#

so it's not related to discord.js at all

#

but from you having a broken better-sqlite3 install

#

that happened to error on npm install

signal prairie
#

And then how I will fix it?

tight heath
#

npm rb

#

should do the trick

signal prairie
#

Yeah it worked

tight heath
#

:)

signal prairie
#

=)

signal prairie
#

Well Updated my library to 12.0.0-dev

tight heath
#

don't use quick.db. seriously.

stray garnet
#

Ok

#

But what then?

#

.json files arent good at large servers

west spoke
#

a actual database

mossy vine
#

isnt quick.db a wrapper for sqlite3 tho

west spoke
#

Ima work on my own file type for python... idfk

Ima use it specifically for a little project

unkempt moon
#

Honestly what db you use doesn't matter, as long as you use one appropriate to what you're trying to build

earnest phoenix
#

...so it does matter

topaz fjord
#

@mossy vine yes

mossy vine
#

so its technically an actual database

#

just sucks

topaz fjord
#

its a shit wrapper

#

all the downloads is from people who are too stupid to use the actual module

tight heath
#

quick.db aka the db that advertises on error

#

nah but seriously

#

node has a great mongo wrapper

#

there's better-sqlite3

#

if you need something visual, there's firebase

snow urchin
#

messageReactionAdd code:
https://hastebin.com/fazufopici.js
Ready event code:
https://hastebin.com/alusewetix.cs
Message:
https://gyazo.com/45ec8f154cd40f469d1ba414d4d15b78
Problem:
The first time I click the reaction, nothing happens other than the fact that it removes the reaction, like it should.
The second time I react, it creates the ticket channel, and everything works like normal.
The third time I click the reaction, it does everything twice, it tried to create the ticket channel, but I added this code:

      if (message.guild.channels.find(x => x.topic == user.id))
        return message.channel
          .send(
            `${user.toString()}, I am sorry, but you must close your current ticket before opening a new one! Here is the current open ticket: ${message.guild.channels
              .filter(channel => channel.topic == user.id)
              .map(channel => channel.toString())}`
          )

to stop the user being able to create more than one ticket at a time, and that runs twice, and sends the "I am sorry, but you must close your..." twice, and each time I react to the message, with the reaction, it adds to the amount of times it sends the message and tries creating a ticket, what is wrong?

tight heath
#

openT, the reaction collector, is still running

#

you have to either set the limit to 1

#

or close it in the collect event

#

@snow urchin

snow urchin
#

How do I do that

tight heath
snow urchin
#

Will try it πŸ™‚

tight heath
#

have you ever used eslint btw

#

because uh navigating through your code is quite difficult.

snow urchin
#

will look into that later,
now when I try creating a ticket, it does not send the message twice, but still, the first time I react, nothing happens, only starts happening after second reaction

onyx summit
#

how would you name a class that handles ipc connections to child processes?

mossy vine
#

classThatHandlesIpcConnectionsToChildProcesses

onyx summit
mossy vine
#

but its accurate mmLol

onyx summit
prisma bobcat
#

my dumb self forgot to check permissions before doing thing, and gave the wrong permission URL to bot list, and now my email gotten blown up by error reports

earnest phoenix
#

voice channels don't have a topic

twilit rapids
#

Voice channels don't have topics

#

That is the text channel

#

Not the voice channel itself

#

That's for a text channel

#

What?

#

You can update the channel the command is run from

#

Or even the voice channel's name

#

But there is no voice channel topic

valid frigate
#

how can I create a mongodb query string, e.g. db.collection.find({}) but without the console

twilit rapids
#

Whatever

slender thistle
#

Now let's try to get topic of channel qweasd

cold niche
#

What lib and language would you recommend for having a bot and a webgui?

#

Since they both would heavily depend on each other I would like to see them as one single process

valid frigate
#

your choice

cold niche
#

Languages without proper threading therefore are no goes

twilit rapids
cold niche
#

And I don't wanna use an IPC between two processes to communicate between the web and the bot

twilit rapids
#

@slender thistle I love your nickname in that server

slender thistle
opaque eagle
#

what info would u want to send between the web and the bot

#

you could update ur db directly from the web gui

twilit rapids
#

They are updating the TEXT CHANNEL you are running the command in

#

Not the VOICE CHANNEL where the music is playing in

#

Same story

slender thistle
#

That's the text channel's topic

#

Voice channels can NOT have topics

twilit rapids
#

Then what are you trying to proof?

slender thistle
#

Elaborating might help

valid frigate
#

ok guys im still kinda new to mongo, but i'm trying to figure out how to make a command that can query documents like sql

pine edge
#

Hey guys, how i can create an command like prefix<m*> command<s> args1<items> args<amount> ?

earnest phoenix
#

wat

pine edge
#

@earnest phoenix Command with arguments

earnest phoenix
#

in which library

pine edge
#

node js

earnest phoenix
#

library

pine edge
#

What do you mean

quartz kindle
#

Js has at least 3 different libraries

pine edge
#

Oh discord.js

earnest phoenix
#

@pine edge you should probably use commando, https://discord.js.org/#/docs/commando/master/general/welcome

pine edge
#

@earnest phoenix not more issues ?

tall arrow
#

is there a way to put a http site in the description of the bot on the discordbots.org site?

#

in an iframe

#

I dont have a ssl certificate

valid frigate
#

you cant use iframes to display http sites in an https site

inner jewel
#

just use letsencrypt

valid frigate
#

google let's encrypt

tall arrow
#

ik about that but my host blocks bots

#

im gonna try to move on 000webhost

valid frigate
#

why though

#

get a vps lo

tall arrow
#

nah,free is better u know

#

xd

slender thistle
#

In favor of money, yes

#

In favor of quality, not really

tall arrow
#

I dont need a site with a nice domain and stuff

#

cuz noone cares

earnest phoenix
#

000webhost more like 0passwordencryption

valid frigate
#

tbh

#

how can i spawn child processes of my bot without using the shardingmanager

unique nimbus
#

Please dont spam

royal fern
#

If I have a discord bot which has a website hosted (on the same app), and I shard my bot, do I need to restrict the website to only launch on shard 0?

#

Or should I launch the website on the master process?

mossy fjord
#

There even a use for yarn anymore?

simple stump
#

I need some help. I am very confused in storing data. I am looking to do !magic and then someone gets the role "Magicked", but I can't seem to store it? I don't really have any experience in this form of discord.js.

tight heath
#

@mossy fjord no

#

except sending all your data to facebook

#

lol

quartz kindle
#

@simple stump what part of the role do you need to store and why?

simple stump
#

So basically I am trying to code a game in which you can do different spells, such as !fireball and it will take a certain chunk of health based on their level, but I don't know how to store that data for each user that does !magic or a spell for the first time.

unique nimbus
#

database like sql?

#

or store it in ram

simple stump
#

mostly database

#

but i have no knowledge of sql at all. i could learn it but it would take a while

quartz kindle
#

Take a look at sqlite and better-sqlite3

#

Sql is really not hard to learn

unique nimbus
#

sql requires effort

#

I got no effort in me

earnest phoenix
#

i mean

#

you can use orm frameworks

simple stump
#

oh

quartz kindle
#

lol

simple stump
#

wuts that xD

unique nimbus
#

store it in a txt file

#

its the best database

#

smh

simple stump
#

how do i do that?

quartz kindle
#

Dont

simple stump
#

or at least call on the .txt file

earnest phoenix
#

that was sarcasm

unique nimbus
#

that was sarcasm

simple stump
#

o

#

so sql is the best option? where can i learn to store the data using it

quartz kindle
#

Google sqlite

earnest phoenix
#

also orm stands for object relational mapping

simple stump
#

ok thx

earnest phoenix
#

orm frameworks allow you not to have a mental breakdown over writing sql queries basically

unique nimbus
#

but you can die inside anyway

#

its part of the programmers lifestyle

simple stump
#

πŸ˜› ok

#

thx for the help

dusky marsh
#

What is the best way to implement reminders in my bot? I know it definitely is not a good idea to loop over a database containing the reminder timestamps every second, so should i use cron times?

quartz kindle
#

Use timeouts

dusky marsh
#

So just set a timeout for each reminder, and if the bot restarts, just set a timeout for each reminder in the reminder db?

#

Sounds easy enough

#

thank you

quartz kindle
#

πŸ‘Œ

earnest phoenix
#

yo can anyone help me?

#

so

#

i ran into a problem with dc.js@12.0

#

idk how to check member perms :c

#

can anyone help me out there?

#

(anyone?)

hollow saddle
amber fractal
#

The docs sure can help you

#

idk if there's anything different

hollow saddle
#

Oh yeah v12

#

I don’t believe so in terms of permissions

#

Could be wrong though, I don’t use v12

amber fractal
#

It doesnt look any different, but he should use the 12.0 docs anyways Β―_(ツ)_/Β―

split hazel
#

what would the best database be?

#

for a nodejs bot that pretty much reads/writes many times every second

#

and it needs to do it pretty quickly

idle fox
#

How do I get the bot developer role

earnest phoenix
opaque eagle
#

You see all those exports in Util/index.js? I want to aggregate all of them under Util in index.js, but it won't workjs // ~/Modules/Util/index.js export { default as codeBlock } from "./codeBlock"; export { default as formatNumber } from "./formatNumber"; export { default as genericFooter } from "./genericFooter"; export { default as isThenable } from "./isThenable"; export { default as random } from "./random"; export { default as shuffle } from "./shuffle"; export { default as toProperCase } from "./toProperCase";``````js // ~/index.js export * as Util from "./Modules/Util/";

valid frigate
#

you can't use as Util after *

opaque eagle
#

how do i do it then

valid frigate
#

dont take my word for it but i believe you can just export the class: export class Util

#

and then import it into files you want to use

copper cradle
#

m o d u l e . e x p o r t s . U t i l

#

oh wait

#

you're not using node

#

that's plain browser js

valid frigate
#

that's es6

copper cradle
#

y e

opaque eagle
#

It's not a class tho @valid frigate

valid frigate
#

oh yeah

#

in that case module.exports.Util might be your best bet

#

i didnt notice this might be an module you're making

opaque eagle
#

but no module.exports pls

valid frigate
#

what are you making then?

opaque eagle
#

discord bot

#

but i like es modules

valid frigate
#

es6?

#

you can just use export before any variable/class declaration

#

export let, export const etc

opaque eagle
#

ik

#

but im exporting default exports from other files

#

look at the code

valid frigate
#

ah i see what you're doing hold on

#

you should make a class Util and add the other exports as methods in it

#
class Util {
static codeBlock() {
}
static formatNumber(){
}
}

etc

#

bruh

#

i hate formatting lmao

opaque eagle
#

Instead of making a class, this works for now```js
export { default as Util } from "./Modules/Util/";``````js
import codeBlock from "./codeBlock";
import formatNumber from "./formatNumber";
import genericFooter from "./genericFooter";
import isThenable from "./isThenable";
import random from "./random";
import shuffle from "./shuffle";
import toProperCase from "./toProperCase";

export default {
codeBlock,
formatNumber,
genericFooter,
isThenable,
random,
shuffle,
toProperCase,
};```

valid frigate
#

gg

#

if you have time though, consider making it a class

#

that makes js more oop lol

opaque eagle
#

i used to have it as a class

#

but now i want to split the functions into different files

#

also im a fan of functional code

valid frigate
#

ah ok

opaque eagle
#

oop is kinda bloated

valid frigate
#

well glad to see you fixed your issue

opaque eagle
#
class Flock {
  constructor(n) {
    this.seagulls = n;
  }

  conjoin(other) {
    this.seagulls += other.seagulls;
    return this;
  }

  breed(other) {
    this.seagulls = this.seagulls * other.seagulls;
    return this;
  }
}

const flockA = new Flock(4);
const flockB = new Flock(2);
const flockC = new Flock(0);
const result = flockA
  .conjoin(flockC)
  .breed(flockB)
  .conjoin(flockA.breed(flockB))
  .seagulls;```
#

That's some OOP code

#

All of that can be simplified to this line: js flockB * flockA * 2

#

That second line is functional

#

I'll take the second one kthx

valid frigate
#

hmm

#

code is what you want it to be

#

if you like functional programming go for it mmLol

opaque eagle
#

I'd like my code to be anything but bloated πŸ‘

#

gtg bye

lament lava
#

Hello.

earnest phoenix
#

Hi

lament lava
#

Resolve?

#

I make a gold member system.

#

But a render error.

blissful dove
#

Kanka

lament lava
#

?

earnest phoenix
#

A template is not found

blissful dove
#

O hata nerde verdi

earnest phoenix
lament lava
#

dashboard.js

blissful dove
#

Yani ne yaparken verdi

lament lava
#

Gold ΓΌyelik sistemi.

earnest phoenix
#

templates/undefined

blissful dove
#

Hm

earnest phoenix
#

No tr here 😩

lament lava
#

@earnest phoenix The resolve?

blissful dove
#

Kodda sorun var o zaman

earnest phoenix
#

Idk i can't resolve that for you

blissful dove
#

Değiştir

lament lava
#

@blissful dove

blissful dove
#

Kodu

earnest phoenix
lament lava
#

Sende var mΔ± sistem?

#

@earnest phoenix

#

One minute plz.

blissful dove
#

Bende yok ama bende yapmayı düşünüyorum

earnest phoenix
#

@slender thistle

slender thistle
#

ily notr

covert turtleBOT
lament lava
#

@slender thistle

blissful dove
#

Okey

lament lava
#

Can you help me?

#

What is this error?

earnest phoenix
#

Lol

lament lava
#

I'll making a gold member system.

slender thistle
#

Just because I appeared in the chat doesn't mean I could probably help

#

Looks like it can't find a folder

earnest phoenix
#

Or a file

lament lava
#

Hmm.

#

What is the line?

earnest phoenix
#

in app/dashboard/templates/undefined

arctic flume
#

the problem is the view path: "/app/dashboard/templates/undefined

lament lava
#

How can it?

earnest phoenix
#

Show your code

lament lava
#

What is the line?

#

118 or 73

earnest phoenix
#

Idk lol

arctic flume
#

That means that the string "/app/dashboard/templates/ " is combined with a variable that equals undefined

#

118 is the line

lament lava
arctic flume
#

What's the source for the function render template?

lament lava
#

@arctic flume

#

I'll making a gold member system.

arctic flume
#

as we've already established

lament lava
#

My friend make it.

arctic flume
#

Ok

#

But show the source for the function renderTemplate

lament lava
#

@arctic flume

earnest phoenix
#

Ctrl + f -> renderTemplate -> enter -> send result here

lament lava
#

A

arctic flume
#

Wait

lament lava
#

Okey.

arctic flume
#

Try searching for function renderTemplate instead

lament lava
#

Just they are.

arctic flume
#

Or if that doesn't work, renderTemplate() =>

lament lava
#

Okey.

#

I'll try.

#

Wait plz.

arctic flume
#

If neither of those work, try renderTemplate =

lament lava
#

look at this line.

#

premium folder is no.

arctic flume
#

not what I wanted

lament lava
#

@arctic flume

arctic flume
#

But if there is no premium folder

lament lava
#

Look at your dm plz.

arctic flume
#

Then there is no uyelik.ejs

earnest phoenix
#

Hello, when I want to run my bot, I put the token but he tells me he is disabled while yet it is valid. How can I do it?

(node: 4944) UnhandledPromiseRejectionWarning: Error: An invalid token was provided.
Β Β Β Β at Promise (C: \ Users \ Lauchet \ Desktop \ Vinchenzo \ thekingmusic \ node_modules \ discord.js \ src \ client \ rest \ RESTMethods.js: 34: 54)
Β Β Β Β at new Promise (<anonymous>)
Β Β Β Β at RESTMethods.login (C: \ Users \ Lauchet \ Desktop \ Vinchenzo \ thekingmusic \ node_modules \ discord.js \ src \ client \ rest \ RESTMethods.js: 33: 12)
Β Β Β Β at Client.login (C: \ Users \ Lauchet \ Desktop \ Vinchenzo \ thekingmusic \ node_modules \ discord.js \ src \ client \ Client.js: 280: 30)
Β Β Β Β at Object. <anonymous> (C: \ Users \ Lauchet \ Desktop \ Vinchenzo \ thekingmusic \ MusicBot.js: 200: 8)
Β Β Β Β at Module._compile (internal / modules / cjs / loader.js: 778: 30)
Β Β Β Β at Object.Module._extensions..js (internal / modules / cjs / loader.js: 789: 10)
Β Β Β Β at Module.load (internal / modules / cjs / loader.js: 653: 32)
Β Β Β Β at tryModuleLoad (internal / modules / cjs / loader.js: 593: 12)
Β Β Β Β at Function.Module._load (internal / modules / cjs / loader.js: 585: 3)
(node: 4944) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated from the inside of the outside world, but it was not handled by .catch (). (rejection id: 3)
(node: 4944) [DEP0018] DeprecationWarning: Unhandled promised rejections are deprecated. In the future, it will not be possible to terminate the Node.js process with a non-zero exit code.```
mossy vine
#

are you sure its your token and not the api secret

opaque eagle
#

Also make sure discord.js is up to date

earnest phoenix
#

discord.js is in a latest version

#

is a token and not the api secret @mossy vine

sick cloud
#

update discord.js anyways

#

npm update or yarn update depending on what you use

earnest phoenix
#

ok

#

same error @sick cloud

cinder patio
#

are you on master

earnest phoenix
#

how can i do

#

no

tight heath
#

shush

#

you're all not solving the problem

cinder patio
#

is your token in an env file, or do you directly put it in a string and pass it to the login function

tight heath
#

a token issue is not a matter of master/stable smh

earnest phoenix
#

no

tight heath
#

also yes, might wanna share your code, and censor the token

cinder patio
#

actually

earnest phoenix
#

client.login("my token")

cinder patio
#

this happened recently

tight heath
#

if he updated it shouldn't be an issue

#

irrelevant of master/stable

#

@earnest phoenix does your token start with M or N

earnest phoenix
#

N

tight heath
#

okay so seems valid

#

what a scam then

#

can you provide some more code

earnest phoenix
#
const Discord = require('discord.js');
const client = new Discord.Client()
const bot = client;
const Util = client;
let PREFIX = "t!"
const YouTube = require('simple-youtube-api');
const ytdl = require('ytdl-core');
var ffmpeg = require('ffmpeg');
client.login("token");

const youtube = new YouTube("api yt");```
tight heath
#

even tho this code is ugly af it's not wrong

earnest phoenix
#
(node:9568) UnhandledPromiseRejectionWarning: Error: An invalid token was provided.
    at C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic\node_modules\discord.js\src\client\rest\RESTMethods.js:34:54
    at new Promise (<anonymous>)
    at RESTMethods.login (C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic\node_modules\discord.js\src\client\rest\RESTMethods.js:33:12)
    at Client.login (C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic\node_modules\discord.js\src\client\Client.js:280:30)
    at Object.<anonymous> (C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic\MusicBot.js:200:8)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:931:10)
(node:9568) 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(). (rejection id: 3)
(node:9568) [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.```
#

There are no solutions then?

tight heath
#

no because if i copy and paste your code it works lol

earnest phoenix
#

lol

sick cloud
#

run npm version discord.js

#

i think

earnest phoenix
#

ok

#
npm ERR! (run in package dir)
npm ERR! 'npm -v' or 'npm --version' to print npm version (6.10.3)
npm ERR! 'npm view <pkg> version' to view a package's published version
npm ERR! 'npm ls' to inspect current package/dependency versions
PS C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic>```
sick cloud
#

bloblamp ok uh

#

run cd node_modules then cd discord.js from your bots dir, then npm version

earnest phoenix
#
  thekingmusic: '1.0.0',
  npm: '6.10.3',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  llhttp: '1.1.4',
  modules: '72',
  napi: '4',
  nghttp2: '1.39.2',
  node: '12.8.1',
  openssl: '1.1.1c',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.30.1',
  v8: '7.5.288.22-node.16',
  zlib: '1.2.11'
}
PS C:\Users\Lauchet\Desktop\Vinchenzo\thekingmusic>```
#

ok

#

'discord.js': '11.5.1',

tight heath
#

okay so it fails for the websocket connection

earnest phoenix
#

ok

#

so ?

tight heath
#

the issue GFeud described is irrelevant here

#

so it's not a version thing

#

can you regenerate your token

#

and use that one

#

because this kinda limits it down to be an error on your end

earnest phoenix
#

ok

sick cloud
#

is the bot in a team or do you own the application by yourself

earnest phoenix
#

i have a question
i asked it before but it kinda didnt worked so
how do i check a members permissions or if he has one specific in discord.js in v12.0.0 --dev?

opaque eagle
#

GuildMember.hasPermission() I think

earnest phoenix
#

doesnt work

#

@sick cloud its my own bot

sick cloud
#

@earnest phoenix <GuildMember>.permissions.has() for member perms

earnest phoenix
#

ok

sick cloud
#

hasPermission is stable/v11

opaque eagle
#

What’s up with that

earnest phoenix
#

same error @tight heath

sick cloud
#

@opaque eagle docs didn't get updated

opaque eagle
#

Lol

tight heath
#

@sick cloud yes they did

#

you just gotta select the correct version

earnest phoenix
#

works perfectly kappa

sick cloud
#

ok

earnest phoenix
#

uh

sick cloud
#

mem1 isn't a guildmember then

earnest phoenix
#

if(!mem1.hasPermissions('KICK_MEMBERS')) { }

#

yes

sick cloud
#

that's stable vinx

opaque eagle
#

Show where you defined mem1

earnest phoenix
#

mem1 is definied as message author

#

so

opaque eagle
#

That’s User, not GuildMember @earnest phoenix

tight heath
#

lmao

earnest phoenix
#

oofβ„’

opaque eagle
#

message.member.permissions.has()

#

Try that

earnest phoenix
#

ok

sick cloud
earnest phoenix
#

if(!message.member.hasPermissions("KICK_MEMBERS")) { }

tight heath
#

still

#

permissions.has

#

welcome to master

earnest phoenix
#

uh

#

ok

tight heath
#

you're using an old version of d.js

#

There's a newer one

earnest phoenix
#

@tight heath so for my problem ?

tight heath
#

with a better syntax

#

idk man d.js itself looks fine

#

might wanna ask on their discord

earnest phoenix
#

@opaque eagle you are my hero thanks

#

ok

sick cloud
#

i literally said permissions.has

tight heath
#

shhh

sick cloud
#

yet no thanks, ok

tight heath
#

tony

#

shh

#

go write jot

earnest phoenix
#

@sick cloud i like u too

#

lul

opaque eagle
#

You have the invalid token error right? @earnest phoenix

tight heath
#

yes

#

on the websocket connection

#

Client#connect

opaque eagle
#

Question 1: Are you trying to log in with some random bot token you found online?

sick cloud
#

ok

stray garnet
#

Jump to

at Object.module.exports.run (/app/c/lelele.js:12:29)1:55 PM

Jump to

at Client.bot.on.message (/app/index.js:203:34```

what does that mean?
#
const mongoose = require('mongoose');
const bcfg = require("../botconfig.json")
mongoose.connect(bcfg.database, { useNewUrlParser: true }, err => {
    if (err) console.error(err);
    console.log(mongoose);
});
const Money = require('../models/money.js');

    module.exports.run = async (client, kayn, REGIONS, config, message, args, con, guilds) => {
        Money.findOne({
            userID: message.author.id,
            serverID: message.guild.id,
        }, (err, money) => {
            if (err) console.error(err);
            const memberInfo = new Discord.RichEmbed()
                    .setTitle('πŸ’° Coins Info')
                    .setAuthor(`${message.author.username}`, `${message.author.displayAvatarURL}`)
                    .setDescription('Participant in channels under the help category, and win coins to buy roles or additional xp')
                    .setThumbnail(`${message.author.displayAvatarURL}`)
                    .setTimestamp(new Date())
                    .setFooter('πŸ’΅ Coins System');

            if (!money) {
                memberInfo.addField('Total Coins', 0);
            }
            else {
                memberInfo.addField('Total Coins', money.money);
            }

            return message.channel.send(memberInfo);
        });
}
    module.exports.help = {
      name: "c",
      aliases: []
    }```

code
severe socket
#

Cannot read property 'author' of undefined
<smthing>.author is not working because <smthing> is undefined

#

also there is the exact line of this happening

stray garnet
#

Its all message

severe socket
#

here i assume message is undefined? so that means you are incorrectly passing arguments in the run method

stray garnet
#

and message is defined

severe socket
#

message is defined but its value could be "undefined"

stray garnet
#

and how to fixx it

#

fix

severe socket
#

console.log(message) and see the value of message

stray garnet
#

Ok

severe socket
#

to fix it, you check how you are passing all those arguments to this function

#

and you might be incorrectly passing arguments

stray garnet
#

uh yea

severe socket
#

show maybe

#

it's not too much

stray garnet
#

so

severe socket
#

but somehow message equals "undefined"

stray garnet
#

BUT HOW

#

reeeee

severe socket
#

show me how you call this function

stray garnet
#

wym?

#

ik im stupid

severe socket
#

where do you use this function?

stray garnet
#

I'm overwhelmed lmao

#

I know... Im retarted

severe socket
#

did you even code your bot yourself?

#

you are defining a function in this file.
Where do you use this function

stray garnet
#

Yea but that is a Copy and Pasted code for testing how it with an Database works, yk

#

oh shit

#

im stupid i founr the error

indigo geyser
#

Python - I am searching to do a command for get the emoji url, like emoji ✊ and it return the link of the emoji, i tried this ```python
@star.command()
async def emoji(ctx, emoji):
await ctx.send(emoji.url)

slender thistle
#

emoji is a string

#

✊

indigo geyser
#

Ok

slender thistle
#

Right, that's discord.PartialEmoji

indigo geyser
#

Mmh... Ok

#

So

#

Like

slender thistle
#

There was a special converter one sec

indigo geyser
#

emoji <name>

#

Oh

#

Ok

#

Thanks

slender thistle
#

Discord emojis don't have URLs, custom emojis do

indigo geyser
#

Okkk

#

Thanks

#

No, same error @slender thistle

slender thistle
#

Send code

indigo geyser
#

(the bot is in the server with that emojil

slender thistle
#

You didn't change anything right

indigo geyser
#

No

#

I only tried with custom emojis

indigo geyser
#

emoji: discord.Emoji?

slender thistle
#

You have PartialEmoji and Emoji converters as possibilities

#

There's honestly two options

indigo geyser
#

Okkk thanks

slender thistle
#
  1. Use typing.Union to support both
  2. use Emoji converter and only support custom emojis
indigo geyser
#

Ok it works

#

Thanks

feral storm
#

So i am remaking a play command, I got it so the bot joins the channel but wont play the song requested. or just leaves straight away, Any idea's?

coral trellis
#

Make sure the correct modules are installed correctly

feral storm
#

Could you tell me what modules they are please, Been a while since i did a play command

coral trellis
#

Well I don't know what modules you're using

feral storm
#

tell me the best ones to use and i will remove the old ones πŸ™‚

slender thistle
#
- folder
    - file.py
    - errors.py

file.py:

from .errors import *

My docs:
No module named 'errors'

feral storm
#

im discord.js not .py

twilit rapids
copper cradle
#

it's an example

stray garnet
#

How to log when a User changed their Name?

#

Discord.Js

earnest phoenix
#

I just wanna know
More people use discord.py or discord.js

#

I think discord.js

#

Oh cool

stray garnet
#

d.js is best

earnest phoenix
#

discord.js gang

#

who needs variable types anyway

quartz kindle
#

Who needs ram anyway

pine edge
#

Hi, when I want to subtract does work i dont why because if i use -- or ++ that work fine

 case "s":
        //Last try
            const test = [
                'money', 'gem', 'prayer',
                'gun', 'chains', 'leaves', 'nothing'
            ];

            if (test == null || args.length == 0) return message.reply('You must specify an item to sell.');

            if (test.includes(args[0]) && parseInt(args[1]) > 0) {
                if (args[0] === test[1] && args[1] >= 1) {
                    let gemMoneyWon = 50; 

                    data[message.author.id].gem - args[1]; 
                    data[message.author.id].money + gemMoneyWon * args[1];
                    write();
                }
            
                
            } else {
                console.log('nop')
            }        

            function write() {
                fs.writeFile('./data.json', JSON.stringify(data), function(err) {
                    if (err) console.log(err);
                });
            }
            break;
earnest phoenix
#

Does fetching a guild as in myGuild = message.guild count towards API rate limiting requests?

#

You are not assigning any value you are only accessing it @pine edge

pine edge
#

The value = the amount of args[1] @earnest phoenix

earnest phoenix
#
data[message.author.id].gem - args[1]; 

you are taking about this line aren't you?

pine edge
#

Yes and the second line too

earnest phoenix
#

you need to do something like this

data[message.author.id].gem -= args[1]; 
dapper glade
#

My server command that lists all of the bots servers won’t work because of character limit. How would i be able to make another message that carries it on?

pine edge
#

@earnest phoenix and for the second line += args[1] * gemMoneyWon; ?

earnest phoenix
#

@pine edge Yess

hollow saddle
#

What Lin crypto

#

*lib

dapper glade
#

discord.js

pine edge
hollow saddle
#

You use split options, message.channel.send('message', { split: true }

pine edge
#

@earnest phoenix problem fix i love you

dapper glade
#

Ahh, okay thanks @hollow saddle

hollow saddle
#

Np

earnest phoenix
#

@pine edge i don't know how to explain what you were doing wrong

#

not good with explaining stuff :/

pine edge
#

just -= += fix my problem

earnest phoenix
#

yeah but the notion you had of what you were doing was wrong :/

#

its pretty important that you fix that

pine edge
#

Which ?

late hill
#

You were simply doing the calculation and not storing it anywhere

earnest phoenix
#

yeah exactly

pine edge
late hill
#
let a = 1;
a + 1; //equals 2 but won't change anything to a
a = a + 1; //a gets increased by 1 (it'll be 2 now)```
pine edge
#

{"293779148424609793":{"money":53,"gem":48,"prayer":6,"gun":8,"chains":3,"leaves":9}

late hill
#

And as you mentioned there's also ++

#

Which is used as a shortcut to increase by 1

pine edge
#

Yes

late hill
#
let a = 0;

a = a + 1;
a += 1;
a++```
#

All 3 of those do the same thing

pine edge
#

a++ = + 1

#

Just

earnest phoenix
#

!lb

#

Lol

#

πŸ‘€

#

anyone here knows anything about sharp and how i can send the buffer?

pine edge
#

Sorry I really have trouble expressing myself in English

earnest phoenix
#

No problem :)

#

^^help

#

^^si

#

(anyone?)

earnest phoenix
#

i have this const collector = new discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, { time: 10000 }); collector

#

but how do i stop it

#

when i try if (m.content === 'boi') { return; } it still works

dapper glade
#

What does this error mean?

#

UnhandledPromiseRejectionWarning: TypeError: Discord.RichEmbed is not a constructor

mossy vine
#

you are calling Discord.RichEmbed as a constructor

#

but its not

dry oar
#

+play kokot

hollow saddle
#

Are you on master @dapper glade

#

Cause it's Discord.MessageEmbed on master

west spoke
#

@dry oar please stop.

dry oar
#

GG

west spoke
#

Commands shouldn't be used here. Especially not common ones.

earnest phoenix
#

ok so

#

i tried to edit a image with canvas in v12

#

but it says on ctx.drawImage(pic1, 0, 0, canvas.width, canvas.height); that he expects a image or canvas

#

which i dont understand because it should get it automaticially

west spoke
#

is pic1 a canvas or image

earnest phoenix
#

and a canvas i think

west spoke
#

You need a file

#

not URL

earnest phoenix
#

how do i do it with a url?

west spoke
#

You need to make a http request, and save it.

earnest phoenix
#

oof

west spoke
#

Base64 might work

earnest phoenix
#

and...

#

how can i use it? xD

west spoke
#

Google.

#

Idk how to use java

split hazel
#

is a for loop better than forEach for processing around 600 elements?

west spoke
#

either will work

split hazel
#

im talking about the better speed and efficiency

west spoke
#

though you will need to catch errors and break out of the for loop

cinder patio
#

You also can't use the return keyword if that boters you afaik

#

I mean use it for something else, not breaking the loop

late hill
#

A vanilla for loop would be faster I'm pretty sure

#

But I doubt the difference will matter much

#

^ @split hazel

inner jewel
#

for 600 elements you wont notice it

#

unless youre iterating that thousands of times per second

split hazel
#

I'd want the loop to continue even if one element errors

late hill
#

@earnest phoenix collector.stop() should do?

split hazel
#

for example if one of the elements being looped throws an error

#

to ignore it and continue with the other elements as usual

cinder patio
#

then you want to use try...catch inside the loop

#

still doesn't matter if you are using for or forEach

split hazel
#

yeah was gonna say

#

so for a for loop should i just throw all the code in a try catch block and it should be good?

late hill
#

Not all the code

split hazel
#

well everything inside the for loop i meant

late hill
#

yes

cinder patio
#

yeah and you should use the continue keyword in the catch ig

earnest phoenix
#

@late hill i didnt even know that exists lol, tnx

split hazel
#

alright thanks

dapper glade
#

@hollow saddle It came up with the same error

hollow saddle
#

What version are you using

#

Do npm ls discord.js in the terminal in your bot’s folder

dapper glade
#

11.5.1

hollow saddle
#

So then yes, it’s Discord.RichEmbed()

#

How do you define Discord? At the top of your file?

dapper glade
#

const Discord = require('discord.js);

hollow saddle
#

Could you show me your whole code

#

Err well just that file and where the error is

dapper glade
#
module.exports.run = async (bot, message, args, Discord) => {
  const gds = bot.guilds.findAll('available', true);
    var gdsl = "";
    for(var i = 0; i < gds.length; i++){
        gdsl = gdsl + "**Name:** " + gds[i].name +"\n"+ "**ID:** " + gds[i].id + "\n";
    }; 
  const embed = new Discord.MessageEmbed()
        .setAuthor(bot.user.username , bot.user.avatarURL)
        .setTitle('Cryptonox Server List')
        .setDescription(`${gdsl}`)
        .addField(`Total Server Count:`, `${bot.guilds.size}`, true)
        .setColor(0x0000FF)
        .setFooter('Cryptonox Server List!');
  if(credits.ownerID.some(word => message.author.id == word)) {
      await message.channel.send(embed);
}    else return message.channel.send(credits.nopermission);
};
module.exports.help = {
 name: "servers",
  description: "Shows all servers the bot is in!",
  status: "public",
  groups: "ownercmd"
};```
hollow saddle
#

Ok well since you said 11.5.1 it’s Discord.RichEmbed

#

MessageEmbed is only for master

#

And do you pass discord in your run function, probably in your message file?

dapper glade
#

Yes

#

It’s working in all the other files with that run

hollow saddle
#

Hmm odd

dapper glade
#

Yeah Ik...

#

Should I ask in the official discord.js server?

hollow saddle
#

If you want to

late hill
#

I think you may have messed up the arguments there

#

So that Discord isn't actually what you think it is

#

Anyway, what you could do to prevent this is just require it in the places you need it

#

Which is what most people do

#

The stuff you require is cached so that requiring the same thing twice won't make it take up twice your memory if that's one of your concerns

#

^ @dapper glade

pine aspen
#

Hey.

#
bot.on("ready", async () => {
    bot.guilds.forEach(function(guild) { 
        users = guild.memberCount + users 
    });
    const activities_list = [
        "SynCode#3713 coding me! | .help", 
        `${users.toLocaleString()} Users | .help`,
        `${bot.guilds.size} Guilds | .help`
        ];
    
    console.log(`${bot.user.username} is online on ${bot.guilds.size} servers!`);
    if(util.uptime() >= 30) {
        setInterval(() => {
        bot.user.setActivity(`${bot.user.username}'s booting! | ${util.uptime()}`, {type: "WATCHING"});
        }, 10000);
    }
    else
    {
        setInterval(() => {
            const index = Math.floor(Math.random() * (activities_list.length - 1) + 1); // generates a random number between 1 and the length of the activities array list (in this case 5).
            bot.user.setActivity(activities_list[index], {type: "WATCHING"}); // sets bot's activities to one of the phrases in the arraylist.
        }, 30000); // Runs this every 30 seconds.
    };
``` Please this isnt working it just keeps increasing the number and doesnt change to guild amount. no errors given
abstract crow
#

Why is it that any files I call in a single file the errors and console never show up.
Example: I use EJS. Index.js runs each server.js, lets say there is an error in one of the server.js files, I can't tell as the console shows nothing. Why is that?

quartz kindle
#

@pine aspen did you define users anywhere?

pine aspen
#

Yes

dapper glade
#

@hollow saddle the error has gone but now the same problem with the character limit is back

pine aspen
#

Var users = 0

#

Problem it’s not changing

quartz kindle
#

and what does the activity show?

pine aspen
#

It keeps continuing the counting

#

So it goes booting | 10s then 20s 30s and then continue I want it to change after 30 secs

quartz kindle
#

ah so the problem is not the users, its the booting part