#development

1 messages Β· Page 572 of 1

amber fractal
#

Its not black

harsh nova
#

the text is

amber fractal
#

Oh Im blind

harsh nova
#

lol

formal agate
#

yes better but the red bar is a bit distracting but up to you about that

#

it draws your attention

earnest phoenix
#

how i can send a message in every server that my bot is in (Using JavaScript)

formal agate
#

omg why would you want that

ruby dust
#

that can be achieved if you know js well enough and you are at least familiar with discord.js

earnest phoenix
#

@formal agate for informing about stuff

#

k

formal agate
#

umm

#

can't you do a status with a cmd?

#

make a support sever etc?

earnest phoenix
#

wot

#

yhea

dusky steeple
#

Do you spend time staring at bot statuses?

earnest phoenix
#

yes

formal agate
#

lol no

#

but its something

dusky steeple
#

I have a globalannounce command

#

not working lol

formal agate
#

a mass message i just see as something that can go really wrong

ruby dust
#

not my business, but a pro tip: users from other servers don't even care about you, your bot, and even your announcements like these, they added your bot because they can and they just want to use it

#

Β―_(ツ)_/Β―

dusky steeple
#

^^

earnest phoenix
#

yeeto ok

amber fractal
#

Idk

#

My announcements array is like 3 of 220 and something

#

ol

#

Lol*

formal agate
#

😯

ruby dust
#

announcements array?

amber fractal
#

5/230

#

Yes

#

it saves the id of the channels people add when they enable announcements

sick cloud
#

anyways, mass messaging to servers is frowned upon and api abusive. just make an announcements channel in your server

formal agate
#

he has no support server if i had to guess

ruby dust
#

I wouldn't call it as api abusive as anything else, considering there are large bots that have opt-in per-channel announcements

formal agate
#

yes

#

but they do it in stages

#

(if i had to guess)

sick cloud
#

but mass messaging without staging or opt-in

ruby dust
#

it's generally discord's fault at first for giving bots not as strict global ratelimits to call that an api abuse in the first place, in addition to each channel (not even guild) having own ratelimits as they are a major endpoint

amber fractal
#

Whats the best way to go about having multiple people be able to do the same command separately? Because I have a command that people do to make a character, but (obviously) when other people call it while you are still making yours, it stops the one you called

quartz kindle
#

just keep them in separate self-contained functions

amber fractal
#

wym?

#

Make a function for each user when they call it? πŸ€”

quartz kindle
#

idk how your code looks like, but the proper way to do it would be something like...

#

receive message from person A > reply and await response from person A
receive message from person B > reply and await response from person B
person A responds, function that was waiting for response from person A continues

#

function that is waiting for response from person B continues waiting

amber fractal
dusky steeple
#

hmmm What about person C? πŸ€”

#

πŸ˜›

quartz kindle
#

same principle lul

amber fractal
#

It just stops it when someone else calls it tho

#

thats the problem

dusky steeple
#

I figured lol was kind of expecting someone else to say that before I did

ruby dust
#

I actually had a similar question like steven, what if I don't want to let the same user execute the same command again if they did not finish their first one?

amber fractal
#

Thats not my problem, its a person calling the command then someone else calling it while the other one is going

ruby dust
#

like lets take your person A and B theory, how would I not execute the command for the user A if bot is still waiting for the A response

inner jewel
#

create a new state machine for each person on each command call

quartz kindle
#

^

amber fractal
#

My iq big low.

#

Gimme a minute

quartz kindle
#

like when a person executes a function you create and track some kind of status

#

and other functions check for statuses to see if said person is allowed to use other commands or not

ruby dust
#

hm

amber fractal
#

Thats still not the problem tho, I dont care if they use other commands while they are creating a character

quartz kindle
#

also, show the rest of your code, its possible that your message collector is being replaced by another person's message collector

amber fractal
#

That's what it is. I don't know how to make a different one for each person

quartz kindle
#

from my understanding, a message collector is attached to the channel itself

amber fractal
#

Its in dms

quartz kindle
#

so attaching a new collector would replace the old one

amber fractal
#

Each channel cant be the same

#

because its in their dms

quartz kindle
#

ah so you're awaiting the message in a dm channel

amber fractal
#

Yes

quartz kindle
#

idk then, show the rest of your code?

amber fractal
#

Well I think I know the issue and I see my dumbness

grim aspen
#

nodejs won't install discord.js

formal agate
#

.

grim aspen
#

i mean the actual nodejs application

amber fractal
#

Yeah, all of my variables were global

#

now I have an object with the users to separate them

grim aspen
#

it says it can't find the module 'discord.js'

formal agate
#

Ok keep getting this error with no idea on how to resolve. error E:\<PATH REDACTED>\node_modules\integer\build\integer.vcxproj(20,3): error MSB4019: The imported project "E:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:197:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12) gyp ERR! System Windows_NT 10.0.10586 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd E:\<PATH REDACTED>\node_modules\integer gyp ERR! node -v v11.9.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok

#

I think it has to deal with "integer" but idk what that is/idk how to fix and this all worked before on my pc

grim aspen
#

nvm i got it to install

sick cloud
#

@upbeat maple are you still able to help me out with my js issue?

amber fractal
#

What js issue and can it be solved by someone with no iq?

sick cloud
#
    var allImages = document.getElementsByTagName("img");

    var imageList = Array.prototype.slice.call(allImages);

    for (x = 0; x < imageList.length; x++) {
        console.log(`id ${allImages[x].id} strt`)
        if (allImages[x].id == '') {
            console.log(`id ${allImages[x].id} done`)
            allImages[x].setAttribute("data-toggle", "tooltip");
            allImages[x].setAttribute("data-placement", "right");
            allImages[x].setAttribute("title", allImages[x].alt);
        }
    }

I got this far and it logs and all but wont attach anything

amber fractal
#

Oh well I have no iq so Im covered

sick cloud
#

ok

quartz kindle
#

@formal agate thats a build error, most times its related to missing dependencies and/or build tools

#

@sick cloud this worked for me js var allImages = document.querySelectorAll("img"); allImages.forEach(t => t.setAttribute("test","test2"))

#

queryselectorall returns a nodelist, instead of an htmlcollection, which can be iterated using array functions, and its also much easier to use, since it uses the same syntax as css

formal agate
#

All my build tools are right...

sick cloud
#

@quartz kindle i have to only apply to ones with no id

quartz kindle
#

just add a check to the function

#

t => if(!t.id) { t.setAttribute() }

lusty dew
#

Does anyone know how to host a MongoDB server on a Raspberry pi 3 b+?

quartz kindle
#

install it?

#

does it have some kind of limitation or?

lusty dew
#

Well

#

I have it installed

#

but my bot can't seem to connect to it

#

I even made the db it needed

quartz kindle
#

is your bot also in the PI?

lusty dew
#

Yes

quartz kindle
#

is mongod running?

quartz kindle
#

how are you connecting to it?

lusty dew
#

by using the mongodb package

quartz kindle
#

what happens if you type "mongo" in the terminal?

lusty dew
#

prings up the mongo shell

#

brings*

quartz kindle
#

in which address

#

does this appear? connecting to: mongodb://127.0.0.1:27017

#

in the same address?

lusty dew
#

no

#

it says

#

connecting to: test

quartz kindle
#

did you set the binding ip to 0.0.0.0 in your mongo settings?

lusty dew
#

No

#

oof

#

How do I do that?

#

I forgot

clear cloud
#

?

quartz kindle
#

it says in the guide you posted:

#

bind_ip = 0.0.0.0```
lusty dew
#

Ah yea

#

didn't notice the Edit part

#

I don't have an

#

/etc/mongodb.conf

#

I have an etc

#

just not the

#

mongodb.conf

quartz kindle
#

is there a mongod.conf?

#

that tutorial sounds kinda bad

lusty dew
#

Yea

#

I can't find a mongodb.conf

#

at all

quartz kindle
#

i think they meant mongod.conf

#

not mongodb.conf

lusty dew
#

mk found it

#

for some reason

#

it wasn't popping up

quartz kindle
#

alright, check if it has a bind_ip line and change it to 0.0.0.0 for now

#

then if it still doesnt work, add a console.log in your connect function to see if anything comes up

lusty dew
#

Well

#

What if it has the same ip as in my code?

quartz kindle
#

0.0.0.0 means accept connections from all addresses

lusty dew
#

K

#

should I remove the port as well?

quartz kindle
#

you can also set it to 127.0.0.1 which means accept connections only from the local machine

lusty dew
#

That is what it is already

#

127.0.0.1

#

which is also

#

right there

quartz kindle
#

alright, then it should be fine

#

have you tried logging your connect function?

lusty dew
#

But it isn't fine

#

pm2 keeps throwing errors

quartz kindle
#

what error?

lusty dew
#

cannot read log of undefined

quartz kindle
#

lol.... that has absolutely nothing to do with mongodb...

#

why didnt you say so in the first place

lusty dew
#

I get that error when mongodb server isn't running on my pc

#

and when I turn mongodb server back on it fixes

quartz kindle
#

thats a code problem regardless, nothing to do with mongo

lusty dew
#

Mk whatever

#
        MongoClient.connect(url, { useNewUrlParser: true }, (err, client) => {
            if (err) client.log(err)
#

if it is a code error

#

what am I doing wrong

quartz kindle
#

well

#

which client is it supposed to use?

lusty dew
#

top one

quartz kindle
#

so change the name of the second one, else your .log and .db are trying to use the second one, which is probably wrong

lusty dew
#

the .db

#

is supposed to use the second one

#

🀦

quartz kindle
#

then change the names accordingly

lusty dew
#

Ok

oak nova
#

Did something happen?

#
client_session: <aiohttp.client.ClientSession object at 0x7f2925bf4240>```
#

out of nowhere

#

My bot won't log back on

lusty dew
#

Now it is saying cannot read property "db" of undefined

quartz kindle
#

does console.log log an error? before the undefined error

lusty dew
#

Nope

#

:/

quartz kindle
#

whats your code now?

lusty dew
#

change the second client with bot

quartz kindle
#

show

lusty dew
#

Ugh

#

I just fucking closed the damn code

quartz kindle
#

why?

#

just keep it open

lusty dew
#

Bc it gets in the way

quartz kindle
#

i keep all my code open at all time

lusty dew
#

in the pi

#

Well the pi window

#

is small

#

even when it is exapnded

#

it gets in the way

quartz kindle
#

you're using a window server in pi?

#

why dont you use ssh instead

#

.>

lusty dew
#

Cause

#

it isn't my Pi

#

it is my partners pi

quartz kindle
#

ok

lusty dew
#

Anyway

#

I don't see how this matters

#

I am telling you it is bc the MongoDB server is not connecting to the bot

quartz kindle
inner jewel
#

db = bot.db(dbName)

#

you never use that variable

lusty dew
#

What?

quartz kindle
#

db is undefined because bot is undefined, because an err happened, so your code should be interruped at err, but youre letting it continue

lusty dew
#

Bc the MongoDB server is not connecting to the fucking bot

quartz kindle
#

and console.log should be showing an error there, if there is actually a problem with the db connection

lusty dew
#

I have said this 3 times now

quartz kindle
#

and im asking for the error, and you said there is nothing

lusty dew
#

I have told you the error

#

Pm2 is moving to fast to get the error myself to show it

#

it restarts after an error occurs

quartz kindle
#

it should stop restarting after X failed attempts

lusty dew
#

:/

#

I am losing patiance

empty owl
#
 if (!share.includes(invest)) return message.channel.send("Please send a current company.") ```
#

doesnt work

#

invest is an array

quartz kindle
#

also, first of all, make it interrupt the function if err happens: if(err) { console.log(err); return; }

lusty dew
#

There is your error

quartz kindle
#

finally

#

now thats the actual database problem, not the code error

grim aspen
#

i'm getting error in nodejs on pc

#

trying to install discordjs

#

on the application

quartz kindle
#

basically, your mongodb requires wire version 2, but your mongo has version 0, which means its an outdated installation from an outdated tutorial

grim aspen
#

it says it can't find the module ('discord.js')

quartz kindle
#

please install mongo from the mongo website

lusty dew
#

I tried

#

I get errors

quartz kindle
#

then fix those errors

lusty dew
#

Lmfao

#

I tried

#

for 4 hours

quartz kindle
#

cant help you if you dont say what those errors are

lusty dew
#

Well

quartz kindle
#

anyway i need to go to bed so good luck

lusty dew
#

Yea thanks

#

no help at all

quartz kindle
#

@empty owl it should be array.includes(value) not value.includes(array)

empty owl
#

oh

#

crap

dusky steeple
#

Can anyone see what I am doing wrong here?

const config = require('./config.js');
const mysql = require('mysql');
const logger = require('./modules/logger');
const connection = mysql.createPool(config.mysql);

function query(queryString) {
    return new Promise((resolve, reject) => {
        connection.query(queryString, (error, results) => {
            if (error) reject(error);
            else resolve(results);
            logger.log('Info', results);
        })
    })
}

module.exports = query;```
it's not pulling my login info for database
empty owl
#

using mysql

dusky steeple
#

yes

lusty dew
#

I think they are trying to say the problem is you are using mysql

#

Not sure though

inner jewel
#

define it's not pulling my login info for database

dusky steeple
#

its supposed to pull my username and password from config the in the log it returns that the results are undefined

inner jewel
#

because there was an error

lusty dew
#

There is the error

#

with following the guide from the Official MongoDB website

inner jewel
#

google is your friend

lusty dew
#

Now I got this one

#

I googled it

#

and I did what google said

#

still not wanting to work

earnest phoenix
#

I need some help with a problem where I don't want my code to dm me my help commands but I'm not sure what to delete who can help?

#

@inner jewel you know anything your smart

#

What

#

You donc't want your code to dm you?

#

Yes

#

The help command

#

If you meant you don't want your bot to reply to commands on DM just return if the channel type is DM

#

No

#

Ffs

#

Just help

#

The -help

#

= no dk

#

Do what i said then smh

#

Smh kms

#

Return if it's DM

#

Hell no

#

So you don't want help but you want help?

#

I'll ask someone smarter XD

#

L ao

#

Lmao

#

....

#

You are dumb not me

#

If you wrote proper English we would understand each other yk

#

mk

#

Wait

inner jewel
#

did you even write that code

earnest phoenix
#

Yes

#

Well maybe.....

inner jewel
#

if you can't change it to send in the channel instead of DM it i doubt you didn't copy paste it

earnest phoenix
#

I did not

#

I told him that

#

I just want to delete the bit so it don't DM you the help commands @inner jewel

#

@inner jewel what shall I remove

inner jewel
#

read the code

#

if it still isn't obvious then go read the docs

earnest phoenix
#

I'm very thick

coral trellis
#

message.author.send()

earnest phoenix
#

Okay thx

#

He smart

coral trellis
#

That sends it to the author

earnest phoenix
#

Okie

coral trellis
#

Just read the code dude please

earnest phoenix
#

Okay sowwe I'm just thick and blind

#

I was gonna say something about it buut nevermind. It's not even worth it

empty owl
#

NUYNI

#

ew glitch

earnest phoenix
#

Nah glitch is amazing jks

earnest phoenix
#

What's the eval code to ban a member?

daring garden
#

Why does DiscordJS use so much memory? I could run several instances of my web app on the server my bot runs on, while discordjs can barely run a couple shards of the bot which isn't even used that heavily

keen drift
#

idk, profile it

inner jewel
#

because cache

daring garden
#

that's what I was thinking, but what's it caching? i'd thought that the discord protocol would send all the relevant information about a message (server, channel, etc) within the message itself, rather than relying on the bot to cache that info in memory but I'm probably wrong

keen drift
#

Djs is heavily cache reliant

#

If you profile it, you'll get a better understanding of what's using so much

sick cloud
#

the discord api sends us a guild and channel id rawly

#

on bot ready, discord.js (and most libs probably) cache guilds and channels for quick access

daring garden
#

that makes sense.. 5000 servers with n channels each and that in itself is a lot of information

sick cloud
#

i do admit, the gateway sucks

#

not only is it unforgiving for issues, but we get sent next to no data

keen drift
#

?

sick cloud
#

when i made my library, i worked out that you get guild_id channel_id and some really crappy data

#

@keen drift what

keen drift
#

wym next to no data

sick cloud
#

like

#

we dont get invite create events

#

D:

#

i wonder if the gateway actually sends those secretly

keen drift
#

The client just makes a call to fetch invites every time

#

Some of the things can be improved with more lazy load fields, but I think it's pretty good where it's at

sick cloud
#

talking about the gateway fishy

#

like raw stuff

keen drift
#

There's no events for invites

#

The client calls to the api every time it needs to fetch those

sick cloud
#

ok

keen drift
#

You can literally open Discordapp in your browser

#

and inspect the network xhr calls

sick cloud
#

ok

lusty dew
#

Still can't install mongodb on the raspberry pi 3 b+

keen drift
#

raspbian and ubuntu are not the same

#

apt search mongodb

#

mongodb should be in the raspbian repo

lusty dew
#

I have a bunch of stuff

#

I see some mongodb stuff

keen drift
#

try mongodb

#

instead of mongodb-org

#

arm64 tar balls are also available from mongo's site

lusty dew
keen drift
#

so it's already installed?

lusty dew
#

Ig

#

but i get errors

keen drift
#

like what

lusty dew
#

Let me find em

keen drift
#

that thing is blurry as hell

lusty dew
#

god that is surprisingly small

#

Yea

#

I see that now

#

XD

#

Let me get a better one

#

Hopefully that is better

#

?

keen drift
#

are there connection errors

lusty dew
#

What you see are the errors I get

keen drift
#

the error just says you tried to use a null db handler

#

you should check if the connection is even established

lusty dew
#

*look above

#

MongoError

#

it is gren

#

green

keen drift
#

oh why is that in the green

lusty dew
#

part

#

bc

#

Its the way I have it log errors for MongoStuff

#

it logs with the other stuff such as Logging commands loaded, etc

keen drift
#

yeah I would try installing newer mongodb

#

2.4.14 seems old

lusty dew
#

Well, how

#

I tried what I looked up

#

and nothing is working

keen drift
#

https://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/4.0/multiverse/binary-arm64/mongodb-org-server_4.0.6_arm64.deb

lusty dew
#

What am I to do wuth that?

#

with

#

I am new to using Pi btw

keen drift
#

trying to see if mongodb has an updated one for pi

#

I think in the past it had some conflicts with arm architecture

lusty dew
#

Ah ok

keen drift
#

which pi do you even have

#

Can you run getconf LONG_BIT

lusty dew
#

it replied with 32

keen drift
#

k e k

lusty dew
#

Hm?

keen drift
#

32 bit system

lusty dew
#

I have a raspbery pi 3 b+

#

well my friend does

#

:p

keen drift
#

raspbian is 32 bit os I believe

lusty dew
#

he said it has an arm 7.1

keen drift
#

You going need to re-image it with a 64 bit os

#

Debian Buster has a pi variant, a preview

lusty dew
#

of

#

oof

#

How could I do this..

#

and I would need to ask my friend

lusty dew
#

as he owns it

keen drift
#

Burn that to the micro-sd

#

and use that instead of raspbian

#

mongodb should work on that

lusty dew
#

Ok

keen drift
#

assuming the pi your friend has is on the arm64 architecture

lusty dew
#

I am no quite sure

#

I can as him

#

ask*

keen drift
lusty dew
#

Lol

#

He has 2 as well

keen drift
#

I have 2 raspberry pi zero w, and now 2 raspberry pi 3 b+

#

then i'll just 3d print my case

lusty dew
#

Lol

#

I can't afford that stuff yet

#

I am trying to make money

#

*Well I have to wait 15h for my friend to put that debian on his micro sd card

keen drift
#

don't expect smooth rides

#

arm architecture is still pretty slow

lusty dew
#

Yea

#

I want to get a raspberry pi 3 b+

#

Aren't they supposed to come out with a new one?

keen drift
#

no announcement 3b+ is the latest

lusty dew
#

Ah mk

keen drift
#

actually the 3a+ came out 3 months ago, it's a lower spec but cheaper option

lusty dew
#

Ah mk

earnest phoenix
#

@lusty dew hi friendo

lusty dew
#

@earnest phoenix sup lol

sick cloud
#

i have a 3b

trim saddle
#

@earnest phoenix its a toonlink i think

restive bough
#

use screen

#

idk how glitch works

#

but if its an linux server

#

you should use screen

restive bough
peak bloom
#

javascript has await thonk

restive bough
#

yes

#

but you can't wait for an variable to have an certain value

peak bloom
#

what does that even mean in terms of control flow

restive bough
#

javascripts await is for awaiting promises

peak bloom
#

can it just hang there forever if the variable never flips to true

restive bough
#

i guess

earnest phoenix
#

Ley

restive bough
#

lol

peak bloom
#

that doesn't seem very powerful lol

restive bough
#

for certain uses

earnest phoenix
#

idk how works screen, i like a solution in glitch

restive bough
#

it will be usefull

earnest phoenix
#

I'm making a key distribution command, everything almost works, when I execute the command, it sends a dm as it should, but it sends your key is undefined

#

instead of your key is 1, 2 , 3, 4, 5 or whatever key they get

restive bough
#

why do you use " and ' randomly πŸ€”

#

bit messy imo

peak bloom
#

tbh i swap between those regularly and i have no idea why
eslint is the only reason people stay sane when looking at my code

earnest phoenix
#

xd

#

@restive bough what should I do

peak bloom
#

i mean the message means rows[0].a is undefined

#

you're logging rows, should be able to figure out why

earnest phoenix
#

my logs shows this

peak bloom
#

well you can see none of those SpreadsheetRows have an .a property

#

i have no idea what info you're looking for out of those so i can't tell you what to replace it with lol

earnest phoenix
#

wait

#

what should the a actually be

#

if im looking for the text

peak bloom
#

when you write rows[0].a you're saying "the a property of rows[0]" yes?

#

it needs to be some property that will get you the text

#

...i dont really see where the text you're looking for might be in all that tho, you might want to check the api docs for google-spreadsheet

earnest phoenix
#

i did that

#

but i dont seem to find anything

peak bloom
#

from this it sounds like Row 1 should be headers, so if cell A1 is "keys" then when you get the rows 2-5 you can access rows[0].keys

earnest phoenix
#

yeah

peak bloom
#

...so try that lol

earnest phoenix
#

fucking gg

#

thanks

peak bloom
#

np

earnest phoenix
#

how do i use this if i already use ` in my code

#

like, i want to highlight ${rows[0].keys}

peak bloom
#

escape it with \

dusky steeple
#

I might be wrong but maybe like this

\`${rows[0].keys}\`
earnest phoenix
#

o

dusky steeple
#

that work?

dusky marsh
#

You can escape characters just like he showed with a backslash

#

But with string literals, you just need to wrap the entire string in backticks (in js at least)

inner jewel
#

you mean template strings

#

string literals are another thing

dusky marsh
#

Sure, I don't know any of the technical terms, I never bothered to learn them haha

inner jewel
#
const literal1 = "this is a literal"
const literal2 = 'this is a literal'
const literal3= `this is a literal`
const string = "one literal" + 1 + 'another literal' + `third literal`
dusky marsh
#

I just know how things work, being self taught, I never learned the correct terminology for things :P

inner jewel
#

the text is the literal

#

and eg ```js
const thing = some text ${someVariable$} more text

#

"some text " and " more text" are the literals

dusky marsh
#

Ye

peak bloom
#

im pretty sure in that last case the whole thing is a template literal

inner jewel
#

template literal != string literal

peak bloom
#

ye

#

a literal is just any piece of literal data hardcoded in, template literals just happen to allow embedded expressions

daring sage
#

Technical question, my language is Brazilian portugese, if i create the same bot but in English language it’s considered a cloned bot?

#

My bot language*

latent oasis
#
const Discord = require('discord.js');
const config = require("../docs/config.json")
const cmd = require("../docs/commands.js");
module.exports.run = async (bot, message, args) => {
   message.delete();
const embed = new Discord.RichEmbed()
.setColor(config.red)
.setDescription("t! prefix\n help comand is modular, write t!help <module>\n moderation\n fun\n nsfw\n info\n main-commands\n mini-games")
.addField("updates", `Updated help command`)
if(args[0] === "moderation"){
return  cmd.moder(message.channel)
    }
if(args[0] === "fun"){
return cmd.fun(message.channel)
    }
if(args[0] === "nsfw"){
return cmd.nsfw(message.channel)
    }
if(args[0] === "info"){
return cmd.info(message.channel)
    }
if(args[0] === "main-commands"){
return cmd.mc(message.channel)
    }
if(args[0] === "mini-games"){
return cmd.mg(message.channel)
    }
return message.channel.send(embed).then(msg =>msg.delete(20000));
}

No working, no error

#

Pls heeelp

slim heart
#

What is it supposed to be doing

#

@latent oasis

#

What is cmd....

daring sage
#

@latent oasis, try this:

if(args[0] == "info") { message.channel.send(cmd.info) }

#

you need to declare the "args" and the "cmd.info" as well

grim aspen
#

?

daring sage
#

i understood that he used the "cmd.info" as a grip to other file

#

idk, just thinking out loud

quartz kindle
#

@daring sage if both bots are yours then its not considered a clone

daring sage
#

@quartz kindle got it! thanks!

quartz kindle
#

Γ© nois

daring sage
#

Γ© nois

knotty steeple
fervent oyster
#

im trying to take a bot and make it so i can put the commands into indiviual files, the only problem is when i go to reload the commands, the commands in the bot dont get updated. in order for the changes to actually take effect i have to restart the bot, bringing me back to the thing i wanted to avoid. here is the code i use to reload the commands: ```js
Object.values(client.commands).map(c => c.label).filter(c => c !== 'help').forEach(c => {
console.log(c)
client.unregisterCommand(c);
});
var commands = fs.readdirSync('./cmds');
console.log(Loading ${commands.length} commands, please wait...)
commands.forEach(c => {
var cmdFile = require(./cmds/${c});
client.registerCommand(cmdFile.name, (msg, args) => cmdFile.exec(client, msg, args, shardCount), cmdFile.options)
});

knotty steeple
#

clear require cache

fervent oyster
#

how do i do that

knotty steeple
#

delete require.cache[]

#

something like that

#

you would put the path to the file there

fervent oyster
#

ahh, ok

sinful lotus
#
delete require.cache[require.resolve(`./src/commands/${command}.js`)];
this.commands.delete(command);
this.commands.set(command, require(`./src/commands/${command}.js`));

@fervent oyster delete it from require cache, delete it from map, then set it again like this

fervent oyster
#

ok

knotty steeple
#

i would be sure client.unregisterCommand(c);

#

this removes it

sinful lotus
#

if you use a framework

fervent oyster
#

im using eris's commandclient

sinful lotus
#

you could either do it manually or that unregisterCommand for ease

knotty steeple
#

i use my modified d.js command handler

sinful lotus
#

if eris ahve that

fervent oyster
#

eris does have unregisterCommand

sinful lotus
#

my handler is kinda self written so I still need to do that, well try using that

knotty steeple
#
    delete require.cache[require.resolve(`./${commandName}.js`)];
    coffee.commands.delete(commandName);
    const props = require(`./${commandName}.js`);
    coffee.commands.set(commandName, props);
``` how my reload works
#

basically

sinful lotus
#

are you sharded by any chance?

knotty steeple
#

no

sinful lotus
#

I see then that would not have issues

fervent oyster
#

yes, but i already figured out how to reload all shards commands

#

from any shard

sinful lotus
#

nah was refering to samurai since his reload will be problematic in multi shards

knotty steeple
#

how so

sinful lotus
#

simply because that will only reload your command from a single shard

#

ex: you got shard 0 and 1 and you reloaded in 1

#

that will only reload shard's number 1 command

knotty steeple
#

oh

#

yea

sinful lotus
#

from the way I see it

amber fractal
#

Mine works on all shards... or should mmLol but I dont use eris

fervent oyster
#

i have all my shards running a localhost webhook, so when i run the command it reloads everything on that one shard then calls to the other shards to reload

sinful lotus
#

for me I just send a message to master process

#

master process will prompt all the shards to do the reload

knotty steeple
#

master process

sinful lotus
#

my bot uses traditional sharding of d.js

#

<master process> -> child process

#

child process sends message to master master will reply to child

split hazel
#

Referring to redis, what is meant by "high performance"?

quartz kindle
#

Redis is an in-memory database

#

Its entire dataset is stored in ram, and only makes periodic backups to disk

#

While most databases are the other way around

#

Redis is known to be one of, if not the, fastest databases out there

split hazel
#

So redis is best used for caching?

quartz kindle
#

Yes, thats one of its primary uses

#

But it can also be used as a primary database

split hazel
#

I see

halcyon torrent
#

does someone use Eris please? I cant find out which event is triggered when kicking a member, maybe I'm blind but gne :d

amber fractal
#

You cant see the difference between kicking and leaving I dont think

halcyon torrent
#

hm, but, how for example Tatsumaki is able to separate kicks and leaves ?

amber fractal
#

I think raw events exist and you can check if the latest audit log was a kick mmLol

halcyon torrent
#

got it, thanks a lot BlockSmiley

amber fractal
#

Taking my advice mmLol idk if that is the best idea

craggy fox
#

hi

#

can anyone help with a small js/css issue?

mossy vine
#

i can maybe help with js

#

dont know jackshit about css tho

#

just post your question

craggy fox
#

its to do with web development

#

so i have a responsive navigation bar that changes depending on screen size

#

the problem is for mobile only
the first time i click on the three lines to open up the nav but it just pops up but when i close and re open again it does the animation i made but it doesnt work the first time i click on it for some reason

#

been trying for 30 mins now and no results

#

i can screenshare if needed

mossy vine
#

so im very new to this kind of stuff and i want to learn, but have no idea what im even looking for
i want to create a file on my desktop that when i double click executes a bunch of commands
running different commands in different folders, such as opening them up to different ports on localhost
im on windows if that matters
again, if someone can just give me a link that can get me started i would be very thankful

#

anyone able to at least link me to something to get me started?

knotty steeple
#

so

#

an executable that runs other executable

mossy vine
#

uhm

#

more like

#

an executable that does stuff i would type in cmd

#

appearently a batch file is what i need?

knotty steeple
#

should

#

need

mossy vine
#

so batch can like

#

navigate in a folder, run somethiing
navigate in other folder, run something else
etc?

knotty steeple
#

hmm

#

yes iirc

#

seen something like that before idk

mossy vine
#

okay ill look into it thanks

knotty steeple
#

does this work

mossy vine
#

wait but that will open up a bunch of cmds, wont it?

#

wait it needs to have a bunch of cmds open anyways

#

hmm

knotty steeple
#

yes

mossy vine
#

cant it be done so its in the background and doesnt annoy me?

knotty steeple
#

dont know about that

#

at startup sometimes i can see prompts but they close really quickly

#

so not completely hidden

mossy vine
#

i localhost with python -m http.server <port>

#

which requires a cmd to be open

#

so

craggy fox
#

@knotty steeple u know anything about web dev?

knotty steeple
#

u know the channel topic says dont randomly ping people

craggy fox
#

i didnt see that sorry

knotty steeple
#

i saw your question

#

i have a reason i didnt answer it

mossy vine
#

wait how do i go up a directory?

#

because i know i can do cd directory

#

but how do i go up?

harsh nova
#

cd /folder?

knotty steeple
#

cd ..

harsh nova
#

Oh gg

mossy vine
#

oh that sounds like it

#

yup thats it, thanks!

knotty steeple
#

cd ../.. to go up 2 folders

#

etc

mossy vine
#

okay so as i expected

#

stacking up commands doesnt work

inner jewel
#

start python -m ...

mossy vine
#

aaaand now i have a bunch of cmds open

#

exactly what i wanted to avoid in the first place

inner jewel
#

start /b

mossy vine
#

does the /b go before or after ...?

inner jewel
#

before

mossy vine
#

doesnt work with before

#

seems to work with after

#

but only one of the localhosts work

#

yep, one works well and other just.. doesnt

#

ill remove the /b and see if i get any useful output

dusky steeple
#

Could someone tell me what I am doing wrong here. I am making a command to make the bot leave a server. When I try it just tells me it can't find the server.

const config = require('../../config.js');
exports.run = async (client, msg, args) => {
    const guildID = args.slice().join(' ');
    if (!config.ownerID.includes(msg.author.id)) return msg.channel.send('You don not have permission to use this command.');
    if (!guildID || isNaN(guildID)) return msg.channel.send('You must enter a server id.');

    try {
        await client.guilds.get(args).leave();
    } catch (error) {
        return msg.channel.send('I could not find this server.  Please check if the server id is correct and Red Queen is in that server');
    }

    return msg.channel.send(`Red Queen has successfully left ${guildID}`);
};```
inner jewel
#

start /b python ...

mossy vine
#

oh you meant that

#

pff im dumb

#

AYY

#

thankss

#

that seems to work perfectly!

autumn rain
bright spear
#

Probably just discord being discord

amber fractal
#

Yes

grim aspen
keen drift
#

Anyone got some experience with GSM modules? Trying to see which SIM module for my pi I should get for Verzion

split hazel
#

When i spawn 2 shards using discord shard manager, My bot creates way more than 2 instances which causes my memory to leark

#
Manager.spawn(2);```
inner jewel
#

that should have 3 processes

split hazel
#

yeah 3

#

my bot creates way more than 3

#

i can see that by my command handler constantly loading the commands

split hazel
#

But what interests me the most is how do people get those image stats from dbl?

formal agate
#

Ok npm is driving me nut, what does this mean? Its not trying to pull from "PATH" right, because if so that doesn't exist. Downloading installers failed. Error: { Error: EBUSY: resource busy or locked, unlink 'C:\Users\USERNAME\.windows-build-tools\build-tools-log.txt'

grim aspen
#

anybody know discord.js? trying to help a friend code a bot and i don't feel like i'm explaining well

#

i know how to do a bot, but i'm terrible at explaining it to another person

sick cloud
#

get them to ask instead of you asking

grim aspen
amber fractal
#

Well you cant help if they're using dbm

grim aspen
#

i don't know how to do discord bot maker

amber fractal
#

Most people here probably dont either

#

most

formal agate
amber fractal
#

Wait

#

is that what dbm looks like

formal agate
#

its got its own yt page

#

yes

amber fractal
#

How much did you pay for that

formal agate
#

i didn't

#

i used google

amber fractal
#

Oh

grim aspen
#

it's $9.99 on steam

amber fractal
#

Rip off

#

learn to code for free

ruby dust
formal agate
#

ahh

#

got the url format wrong

grim aspen
#

i had the same reaction @ruby dust

ruby dust
#

I'm starting to think that dbm is made generally to make money out of normies that are lazy to learn but want to make a bot

amber fractal
#

It is

formal agate
#

yes

amber fractal
#

What do you mean starting to think Thonk

ruby dust
#

at first I thought it was like a friendly solution for those people, but now I see the truth

sick cloud
#

theres bushfires

#

our house is under threat

earnest phoenix
#

dbm is really a new level of pathethic

#

it produces bad and unoptimized code

sick cloud
#

and uhuhuhuhuhuuhuhuhuh i have an odd question for yall

amber fractal
#

Yes?

sick cloud
#

is it possible to (in clientside js only) make pages change w/o reload

grim aspen
#

nobody knows discord bot maker

formal agate
#

since people are here i guess i should ask a really dumb js question. WhyDOEs tHis Not WoRK? if (props.config.aliases == aliasesProp) { aliases = "<No Aliases>"; } else { aliases = props.config.aliases; }

sick cloud
#

like how vue/react etc do it but not that

ruby dust
#

dbm is actually an embarrassment to development in general, future people will think that they have to pay in order to make a bot

formal agate
#

burry it in google search

earnest phoenix
#

@sick cloud SPAs? yeah, i mean there's an alternative, use css's display: hidden feature

inner jewel
#

replace the dom elements and use the browser history api

earnest phoenix
#

you will have to cram a bunch of divs into one page though

grim aspen
#

they need to delete their app honestly

sick cloud
#

oh

inner jewel
#

you don't need to set them to hidden

#

you can remove them

knotty steeple
#

single page applications 😩

earnest phoenix
#

spas are cool

inner jewel
#

and readd when you load that page again

knotty steeple
#

how do you make one

sick cloud
#

i use multiple pages and ejs/express so uh, dom

earnest phoenix
#

each spa framework has docs on how to get started

sick cloud
#

i want to avoid rewriting my entire program in an spa framework

earnest phoenix
#

i personally use react

sick cloud
#

thats why im asking

knotty steeple
#

uh

earnest phoenix
#

putting a band aid over a hole still makes it a hole

knotty steeple
#

i just tried to run my cli

#

it opened vscode

#

tf

split hazel
#

any idea how to get those 'bot stats' card that some other bots have?

earnest phoenix
#

example? i've got no idea what you're talking about

amber fractal
earnest phoenix
split hazel
#

yeah

compact mauve
#

How would we make a bot create an invite to a server in discord.py?

grim aspen
#

do you have the command for responding to prefixes?

compact mauve
#

yes

earnest phoenix
#

textchannel#createinvite

grim aspen
#

because you can put your invite in the response part

compact mauve
#

not discord.js

grim aspen
#

i know

sick cloud
#

lmao

earnest phoenix
#

ah

#

im blind

compact mauve
#

Oh, the bot doesn't have an invite to put in the response though

knotty steeple
#

btw the above that i reported only happens if i dont run the file itself

#

so i can do node main.js

compact mauve
#

I'm trying to make it create an invite

knotty steeple
#

but i cant do project in cmd

grim aspen
#

i found this:

compact mauve
#

oh thanks

knotty steeple
#

spoonfeed

earnest phoenix
#

don't spoonfed, discouraged ^

amber fractal
#

What?

#

Its the docs Thonk

grim aspen
#

message deleted

amber fractal
#

Wait

grim aspen
#

no they meant me

amber fractal
#

Ok

copper wraith
#

Does anyone know on how to make a weather & time bot for python?

earnest phoenix
#

that question is too generic

ruby dust
#

find some weather api or some shit

#

done

earnest phoenix
#

πŸ‘

ruby dust
#

btw, how do I identify in discord.py which shard is the current server?

amber fractal
#

Well

#

Discord has a thing for that

#

iirc its (guild_id >> 22) % num_shards

#

Wait

#

Wait

#

LOL

ruby dust
#

thanks, just found that guild object has shard_id property

amber fractal
#

lemme see these docs

#

Yeah

#

idk why I sent you how they get it lol

ruby dust
#

why 22 though

#

seems so specific

amber fractal
#

Just how discord does it

split hazel
#

referring to the bot info widget, i cant get it to get the image

lunar venture
#

@grim aspen Thanks for that

grim aspen
#

for what?

lunar venture
#

for the script

quartz kindle
#

use template literal instead of string literal

lunar venture
#

that creates an invite

ruby dust
grim aspen
#

was that for me? @quartz kindle

quartz kindle
#

looks like those are events, no?

#

yes creeper

grim aspen
#

it's supposed to get the ping of the user

ruby dust
#

which is why I'm asking

grim aspen
#

here's the code

#

client.on('message', msg => {
if (msg.content === ':Lksjjd ping') {
msg.channel.send('Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`');
}
});

lunar venture
#

js?

amber fractal
#

Literally my ping command mmLol

split dune
#

em where you have defined?

lunar venture
#

You sent a python script before

grim aspen
#

trying to help someone earlier

amber fractal
#

Its because no backticks

split dune
#

use msg.CreatedTimestamp

quartz kindle
#

@grim aspen as i said, use template literals, not string literals

amber fractal
#

His problem is that he uses single quotes

#

not back ticks

quartz kindle
#
stringliteral = "message";
stringliteral = 'message';
templateliteral = `message`; ```
grim aspen
#

and plus i know python too

split dune
#
client.on('message', msg => {
  if (msg.content === ':Lksjjd ping') {
    msg.channel.send('Pong! Latency is ${msg.createdTimestamp - msg.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`');
  }
});```
quartz kindle
#

thats still wrong

split dune
#

yea I know...

grim aspen
#

yeah it doesn't get that

#

doesn't recognize it as a function

quartz kindle
#

did you do what i said?

grim aspen
#

getting on doing that

split dune
#

const m = await a.message.channel.send(`${a.strings.getMsg("holdon")}...`); m.edit(`πŸ“ | Ping: **${m.createdTimestamp - a.message.createdTimestamp}**ms. Gateway (API): **${Math.round(a.client.ping)}**ms`); I have this thonkku

grim aspen
#

it just got me back to the first problem

split dune
#

You dont have const m

#

or you copy that?

split hazel
#

why wont the dbl widget embed?

grim aspen
#

let's see if that does it

split dune
#

@grim aspen but delete a.

split hazel
#

if i go on it, it shows perfectly but it doesnt wanna embed

#

do i have to use something like jimp to grab the image?

split dune
#

discord dont shows svg

quartz kindle
#

@ruby dust my guess is that those are used for this discord.on_socket_raw_receive(msg)

split hazel
#

jpg doesnt work either thonk

split dune
#

widget is for only .svg

amber fractal
#

its an svg

split hazel
#

it also works with png

#

as it says in the docs

ruby dust
#

highly doubt it, maybe it's for group dms?

split hazel
#

so do i have to get and download the image using jimp then send it?

quartz kindle
#

yes

split hazel
#

alright thanks

quartz kindle
#

the png link works

#

but if you want to embed it in a discord embed, you need to download it and set it as an attachment

knotty steeple
#

@ruby dust probably dms

amber fractal
#

setImage takes a url tho?

ruby dust
#

alright

knotty steeple
#

dont know how a bot would get in

ruby dust
#

yeah just tried with 2 friends, those are dm group message events

quartz kindle
#

so those events are received as a message event?

grim aspen
#

have to reset token

ruby dust
#

they are just a normal message, but are assigned a specific message type like welcome messages and message pinned messages

copper wraith
#

is making a python bot easy>

amber fractal
#

If you know python Thonk

ruby dust
#

discord.py and discord.js are the 2 easiest libraries

copper wraith
#

okay, question

#

Where can I start to learn codes?

sick cloud
ruby dust
#

online

copper wraith
#

alright -_-

ruby dust
#

and also keep an eye on python documentation

copper wraith
#

alright, im just 13, kinda want to learn on how to code xd

knotty steeple
#

guess what

#

im the same age

ruby dust
#

age doesn't matter, anyone can code if have enough passion and patience

copper wraith
#

Noice

amber fractal
#

What does your age have to do with this

knotty steeple
#

thats the point

amber fractal
copper wraith
#

πŸ˜ƒ

knotty steeple
#

i coded when i was 9

#

in like

quartz kindle
#

be ready to have a lot of patience

knotty steeple
#

scratch

#

and

#

basic

amber fractal
#

Scratch best mmLol

copper wraith
#

joking, acutally do know on how to code xd

knotty steeple
#

i forgot all about basic

quartz kindle
#

(x) doubt

copper wraith
#

Just getting stuck on one of my code! yikee

ruby dust
#

just so you know, programming doesn't have an end, you will never learn everything there is provided to you in a single language

copper wraith
#

True

knotty steeple
#

just learn moreβ„’

amber fractal
#

I used bootstrap to make a game in 7th grade mmLol

quartz kindle
#

write code until you no longer need stackoverflow

knotty steeple
#

lmao

#

yes

#

i dont need stackoverflow that much tbh

copper wraith
#

My friend has a python bot, his code is over 2k lines.

amber fractal
#

I use it

knotty steeple
#

i used it like twice for something

ruby dust
#

pfft

#

not much

amber fractal
#

I have like 2 or 3 posts

knotty steeple
#

i had a one file bot

amber fractal
#

Questions*

knotty steeple
#

i dont have questions

#

i just

#

google

quartz kindle
#

one of the best feelings is writing code for like 2 hours non stop without testing it, and when you finally test it, it works

knotty steeple
#

actually i dont even have an account

#

@quartz kindle me never

copper wraith
#

I used to have a pretty good & popular bot, but decided to remove it.

ruby dust
#

most of the time that happens to me

knotty steeple
#

like

#

first attempt my code doesnt work

#

like this image downloader i made

amber fractal
#

I only have 46 rep on stackoverflow mmLol

knotty steeple
#

or most of my bots mmLol

copper wraith
#

Is bootscrap good, I've actually never used it.

ruby dust
#

the only times it doesn't work is if I made a stupid mistake, other than that I can code for hours non-stop and the code works

knotty steeple
#

bootscrap

copper wraith
#

Im only using Visual Studio

knotty steeple
#

visual studio

#

python

ruby dust
#

sublime text is more than enough for python

earnest phoenix
#

I have to try, fix, try, fix but in the end it works

#

lines != quality and complexity

#

instead of looking at lines of code look at quality of code

quartz kindle
#

2k lines of ifs

grim aspen
#

@quartz kindle got it to work but a different way

quartz kindle
#

xD

ruby dust
#

actually, comparing python with any other language is the same as comparing indents and {}

quartz kindle
#

lmao

knotty steeple
#

i use sublime text

#

its 😩 πŸ‘Œ

copper wraith
#

I don't see bootstrap for python.... -_-

quartz kindle
#

i use sublime too

knotty steeple
#

because thats not a thing

grim aspen
#

i had to use a prefixed command

earnest phoenix
#

how is bootstrap related with python again

knotty steeple
#

also

#

its bootstrap

earnest phoenix
#

Yes, that's why, if it is very repetitive when doing a bot

knotty steeple
#

its a web framework

earnest phoenix
#

bootstrap is a css framework...? css isn't even a programming language...?

knotty steeple
#

web

#

framework

copper wraith
#

not rlly

#

Just a web code

knotty steeple
#

not only css

copper wraith
#

Html & Css

#

php

#

etc