#development

1 messages Ā· Page 1819 of 1

earnest phoenix
#

Yep

#

Discord.js wants to be more user friendly ig

#

not like they aren't already

#

lmfao

quartz kindle
#

im not even bothering updating djsl for like 3 weeks now

earnest phoenix
#

Cmon tim

#

follow in djs footsteps

quaint wasp
#

same but I accidently did today

earnest phoenix
#

I would honestly understand why would people never want to update to v13

quartz kindle
earnest phoenix
#

Indeed

quaint wasp
#

like what?

earnest phoenix
#

In an attempt to be more user friendly

#

they made it abnoxious

#

and unfriendly

#

I still would use it though cause I can't be bothered learning something new with the discord api

earnest phoenix
#

Im sorta done with it

#

Not to mention snowflakes being changed to stringified bigints

#

smh

#

should of left it as a string

#

made life a whole of a lot easier

#

They didn't change snowflakes from strings to bigints

woeful pike
#

just use nostrum

earnest phoenix
#

They only changed bitfields to be bigints

woeful pike
#

ez good discord lib

earnest phoenix
#

They legit did

#

They did, but the behavior was never changed

quartz kindle
#

thats literally the same as a string

#

just prevents creating non numeric strings

woeful pike
#

it breaks in some specific usecases

earnest phoenix
#

Not to my ORM

#

My ORM rejects it

quartz kindle
#

dont use ts then

earnest phoenix
#

Says the type is not the same as a string

quartz kindle
#

:^)

woeful pike
#

yeah it's a breaking change

earnest phoenix
#

Tim shut up

#

stay mad

#

d.js v13 is the definition of breaking changes

quartz kindle
#

lmao

#

cant you cast it to string or something?

quaint wasp
#

uhh

#

im thinking of not going to v13 now 😐

earnest phoenix
#

I don't think so

#

iirc I tried and it told me no

quartz kindle
#

v13 is still in heavy development anyway, dont bother using it

#

lot more things will break

earnest phoenix
#

I used v13 cause why not

woeful pike
#

you can't pass a string into a bigint so it breaks a bunch of shit

earnest phoenix
#

Yup

#

Which is one of the reasons I am no longer using prisma as a db orm

quaint wasp
#

alright so I just wont upgrade to it šŸ™‚

woeful pike
#

if you change all snowflake parameters to use ${bigint} it doesn't break but you can't opt into that so it's a breaking change

earnest phoenix
#

yea, wait until v13 is officially released

#

Even when it is officially released

woeful pike
#

I'd ditch discord.js before I ditch prisma holy shit it's amazing

earnest phoenix
#

v13 just gets a breaking change every weak KEKW

woeful pike
#

isn't the bigint thing in v12 too

earnest phoenix
earnest phoenix
#

I don't like not being able to use custom types

woeful pike
#

custom types? like what

earnest phoenix
#

With typeorm I could define the row type to be a string and then give it the type of Snowflake

#

so it saves as a string

#

No problems at all

quaint wasp
#

Welp

#

I forgot the latest version of the version 12.

#

I think it was something like 12.5.6

woeful pike
#

have you considered not making discord bots? That seems like the real problem here

quaint wasp
#

nope.

earnest phoenix
#

Like this

import { Snowflake } from 'discord.js'
import { Column, BaseEntity, Entity } from 'typeorm'

@Entity('test')
export class Test extends BaseEntity {
  @Column({ type: 'text' })
  test: Snowflake
}
woeful pike
#

imagine limiting the thing you're building to the api of a 3rd party platform for no reason OMEGALUL

earnest phoenix
#

I could define the row to be of type text(which is just postgres string ig) but give the definition a type of snowflake so I won't have type mismatch problems when defining test value to be an ID

#

This is what I mean by custom types

split hazel
#

oh for fucks sake

#

i dont wanna sit for 3 hours making the code work again

quartz kindle
#

stick with v12 then

split hazel
#

yeah but v13 has some features that tickle my pickle

wheat mesa
#

use detritus where the features already exist šŸ˜‰

manic roost
#

@alpine crag
This it?

split hazel
#

that changes it from 3 hours to 3 weeks

alpine crag
manic roost
#

Ok

quartz kindle
#

bdfd >.>

long crow
#

I'm like move side to side with the v13 development, like the CommandInteractionOptions stuff from array into collection into option resolver

split hazel
earnest phoenix
#

I dont like detritus

#

Extending their classes suck

proven lantern
#

someone please clean all my code

#

ty

earnest phoenix
#

No

proven lantern
earnest phoenix
#

What is that theme

#

Almost looks like IntelliJ default theme

proven lantern
#

no, it is intellij.

#

not "IntelliJ "

#

completely different

earnest phoenix
#

What

proven lantern
#

trolling

earnest phoenix
#

At least do better

#

and not be stupid about it

proven lantern
#

i need to update my code so it calculates an elo rating for each player of the team and the teams elo ratings

#

it's too tricky

old kite
slender thistle
#

You don't enter top.gg with the sole intent of entering top.gg

#

You enter top.gg with the intent of promoting your decently written bot that's intended to be used in public servers

old kite
#

I understand that

earnest phoenix
#
    if(message.content.toLowerCase().startsWith("radio")) {    
    const voiceChannel = message.member.voice.channel;
    if(!voiceChannel)
    return message.channel.send("You must be in a voice channel!"); 
    
    const permissions = voiceChannel.permissionsFor(message.client.user);
    if(!permissions.has('CONNECT') || !permissions.has('SPEAK')) return message.reply('I am missing permission!');    

    var connection = await voiceChannel.join();
    await connection.voice.setSelfDeaf(true);
    connection.play("https://streams.ilovemusic.de/iloveradio14.mp3").setVolumeLogarithmic(1);
}```
#

I turn this code into a non cmd handler did I do it wrong

#

Bc it keeps Saying await is a error

#

I tried using var connection then I put const connection but await is always the error

alpine crag
wheat mesa
earnest phoenix
earnest phoenix
old kite
earnest phoenix
#

Then that is your issue

wheat mesa
#

Then that's why your code is throwing

earnest phoenix
#

Learn how async/await works

earnest phoenix
#

I tried taken it out

old kite
#

is there a problem ?

earnest phoenix
#

Well they already said there was a problem and its been resolved

#

They need to use await inside an async function

old kite
earnest phoenix
old kite
#

It may be very easy to solve.

earnest phoenix
#

It is very easy to solve

#

as we already told them how

#
client.on("message", message => {
//code
})
```async
```js
client.on("message", async message => {
//code
})
#

Something like this

#

Mhm

lament rock
#

Yo I heard someone got a problem to be solved??? HyperYeptune

earnest phoenix
#

That will make that an async function

halcyon kite
#

hey if anybody knows how to code spigot can i get some help with this:
so when i try to make my custom entity drop a custom item it doesnt work and
the error it sends is the ```java
if(entity.getCustomName().equals("§c§lThe Warden")) {

full code: 
```js
@EventHandler
    public void mobDeath(EntityDeathEvent event) {
     LivingEntity entity = event.getEntity();
     if(entity.getCustomName().equals("§c§lThe Warden")) {
         event.getDrops().clear();
         event.getDrops().add(Main.ironheart);
     }
    }
    
wheat mesa
#

PROBLEM?????

earnest phoenix
old kite
earnest phoenix
#

so

halcyon kite
#

yeah

#

well it just says line 16

#

and line 16 is the custom name

earnest phoenix
#

Well it would be helpful to actually see the error....

#

I won't be able to help since idk spigot but for anyone who does

#

seeing the actual error would be far more helpful

halcyon kite
#

thats all it sends

#

well

earnest phoenix
#

Why do people send screenshots

#

its honestly annoying

halcyon kite
#

lol

earnest phoenix
#

Something like this

#

;-;

lament rock
#

Unrelated, but I'd recommend storing entity IDs you spawn somewhere and go based off that instead of by names since names are arbitrarily assignable

halcyon kite
#

ok

earnest phoenix
bright thorn
#
[ is there any way to start our bot automatically in vps when bot is crashed ]
halcyon kite
#

ill try it out thanks

earnest phoenix
#

You are missing a )

earnest phoenix
lament rock
earnest phoenix
#

Though if its an error on startup

#

it would loop

lament rock
#

while true; ./start-bot; sleep 1; end

bright thorn
earnest phoenix
#

Is this a nodejs project

bright thorn
#

yes

earnest phoenix
#

pm2 start fileName

#

will start the process

#

and if it crashes it will restart

earnest phoenix
#

Can't help with no information

old kite
#

@earnest phoenix Do you have a bot?

bright thorn
earnest phoenix
#

I stopped programming bots

earnest phoenix
#

Don't mind the promise pending

old kite
lament rock
# earnest phoenix

that expression will always return false since the string to match contains an upper case character

earnest phoenix
#

Lmao I forgot all about them type of codes

fair axle
#

Why too many people using mongoose (as npm package) instead of mongodb?

earnest phoenix
earnest phoenix
#

It gets the job done

fair axle
#

mongodb is popular too and as I know mongodb is better than the mongoose in benchmark tests

old kite
earnest phoenix
lament rock
#

people prefer plug and pray instead of having to go through possibly extended setup

earnest phoenix
fair axle
earnest phoenix
#

yea

#

Even the description says it all

fair axle
old kite
earnest phoenix
#

No

lament rock
#

wrappers will always have overhead depending on their design

earnest phoenix
#

I won't disclose to people I don't know what I do with my free time

#

sorry

wheat mesa
#

Anyone here used amazon AWS for hosting their bot and/or might know where to find information about pricing/specifics about the first year being free?

proven lantern
earnest phoenix
earnest phoenix
#

The bot join vc and everything

lament rock
earnest phoenix
#

Wdym wow

earnest phoenix
old kite
earnest phoenix
#

It hardly does anything to actually affect the performance of mongodb anyway doesn't it

fair axle
earnest phoenix
#

I think voltrex just said why

earnest phoenix
#

iirc the performance difference anyways is very little

lament rock
#

insert new devs using d.js

fair axle
#

I'm a bit confused here

#

It should be big differences in big bots

earnest phoenix
#

Not really

earnest phoenix
#

Big bots people dont use mongodb lmfao

lament rock
#

big bots almost always use proprietary software or forks

#

mongo is a meme anyways

earnest phoenix
#

Its a giant meme

#

Postgres is by far better

#

The difference in performance of mongoose and mongodb are really small, they are the same thing but mongoose is just made to support schemas

old kite
#

@earnest phoenix Why are you at a loss from this?

earnest phoenix
#

What are you talking about my g

#

Also big bots mostly never use MongoDB, they use something that can scale well such as postgres

fair axle
#

Alright, Is there any differences about storage size between schemas or not?

earnest phoenix
#

Indeed they do

#

Me I use postgres right off the bat

#

So I dont gotta worry about scaling

old kite
#

silence is better

lament rock
#

sqlite => maria => postgres

earnest phoenix
#

No

quartz kindle
#

sqlite good

earnest phoenix
lament rock
#

my progression is what I was outlining

earnest phoenix
#

Oh

#

Lol

#

I first started out as json

#

4 years ago

lament rock
#

not that they're greater than. I realized that a little too late

earnest phoenix
#

json was my db

quartz kindle
#

i did a small test for my use case, sqlite outperformed both pg and redis

errant flax
fair axle
#

So which database you suggest to build a big bot? Should I start with mongodb and then switch it to postgresql or should I directly start with postgresql

earnest phoenix
#

It doesn't support array types

lament rock
#

Write a TCP server around sqlite

earnest phoenix
#

While it is faster since it is file based

#

Postgres is still the better choice imo

quartz kindle
#

no it doesnt, but neither did most rdbms for a long time

#

you have to design your tables accordingly

earnest phoenix
#

Yes true

errant flax
#

what's postgres?

wheat mesa
#

db

earnest phoenix
#

Postgresql is a db

lament rock
#

sql based relational database

quartz kindle
#

pg is better for large scale indeed, at the cost of the network latency

lament rock
#

Just start with postgres

earnest phoenix
#

ALso

#

If you don't wanna do all the nasty sql queries yourself

lament rock
#

Or pain yourself with redis

earnest phoenix
#

use an orm

fair axle
#

I hate relational databases 😦

earnest phoenix
#

Sequelize is a decent orm for postgres

lament rock
earnest phoenix
#

its also js friendly

#

But if you wanna do sql queries yourself then you will have to use the appropriate package for it

#

Imagine using ORMs

earnest phoenix
#

I know SQL

fair axle
#

If Mongodb is not scalable as postgres why it's so popular?

earnest phoenix
#

Its by far the easiest thing to learn

errant flax
#

i use json bloblul

#

jk

earnest phoenix
quartz kindle
#

mongo was overhyped and overmarketed

earnest phoenix
#

Yep

quartz kindle
#

also, it was targeted at horizontal scaling, which most rdbms have a hard time with

fair axle
#

You are building an application once and I think difficulty shouldn't be that important

lament rock
#

relational does leave some performance on the table due to it not exactly being K,V but relational is a very easy concept to understand and offers some level of type safety depending on how it enforces data types

quartz kindle
#

and everyone was like "ooo horizontal scaling is the next big thing!!"

earnest phoenix
#

MongoDB is like the discord.js of databases, most people use it because its easy and does well for a while

ruby vine
#

In here, can I ask for codes help?

earnest phoenix
#

It is a development channel

#

yes, that's what this channel is for

#

so yes

#

Voltrex make bot when?

lament rock
#

VXComplexity

ruby vine
earnest phoenix
ruby vine
#

xd

earnest phoenix
#

Thanks Discord

lament rock
earnest phoenix
#

Its for chatting about development as well as asking for help

ruby vine
fair axle
#

So, what do you think about the difference between sql and nosql. Which one is more important?

earnest phoenix
#

@earnest phoenix Make bot in C when?

#

I'll make a bot in asm

errant flax
lament rock
#

Depends on what you're trying to do and how large your data sets are

fair axle
#

Okey so, What makes a database more scalable? Why mongodb is not scalable as postgres

quartz kindle
#

nosql is mostly targeted at pototyping and undefined structures

lament rock
#

I/O throughput and which has the least overhead when processing and handling a request

quartz kindle
#

once you have a well defined structure, you usually move to sql

ruby vine
#

Well, the thing is that I want that the bot says: Watching: [Amount of members that bot its in all servers]

fair axle
earnest phoenix
#

no

quartz kindle
#

most times this can be resolved with different configurations

fair axle
#

It was wrong

earnest phoenix
#

That's the cached users, not all the members

fair axle
#

Bot isn't caching all the members

#

(await client.users.fetch()).size maybe?

earnest phoenix
#

no

lament rock
#

you need to wait for the client to reach a ready state and then map all of the guilds member counts to a value

earnest phoenix
#

Reduce member count of all guilds to an accumulator

#

Precisely

lament rock
#

assuming your lib emits ready after most or all guilds have been sent to the client

earnest phoenix
#

Gotta love how when anybody asks a question in here, we all assume they're using d.js

#

*flashbacks*

lament rock
#

Well. Not an incorrect assumption most of the time

fair axle
#

That's true

#

Most of people using node.js for Discord Bots

earnest phoenix
#

yea, we know

lament rock
#

I'd probably start recommending music bot devs to use python or some native js yt extractor since ytdl is written in python and spawning ytdl every request for it to compile it's regular expressions takes a lot of cpu time

errant flax
#

yes but unreliable

earnest phoenix
#

You shouldn't display the amount of cached users if you want all of them

ruby vine
errant flax
#

r guilds automatically cached?

ruby vine
#

@fair axle

#

tw

#

ty

fair axle
#

Do you have any doc about databases. I need deep understanding of them.

fair axle
#

As I know, bot is not caching offline members

lament rock
errant flax
#

wym?

ruby vine
errant flax
ruby vine
lament rock
#

Are you asking anyone here or are you directing that at someone? If asking anyone, I meant what lib and intents are being used

ruby vine
lament rock
# ruby vine

unless you have guild presences intent enabled, that will be incorrect

fair axle
#

You need to use reduce @ruby vine

earnest phoenix
#

You have to reduce the member count of the guilds using <Collection>.reduce()

errant flax
#

what does reduce do hmm

ruby vine
#

So, if a user its on 2 servers and bot its on that 2 servers, if I use the cache it wont detect it on 1 server?

earnest phoenix
#
<Client>.guilds.cache
  .reduce((t, g) => t + g.memberCount, 0);
#

You should use that if you want to display all the members instead of only the cached ones

ruby vine
#

ok

#

ty

lament rock
#

reduce takes a parameter which acts as an accumulator and also a current value which changes based on the iteration of the Iterable. Once all entries have been Iterated over, it returns the accumulator. The accumulator can be any arbitrary value and should be mutated in some way depending on the callback function

#

the return value of the callback function is the new value of the accumulator

earnest phoenix
#

Should have just linked the Array.prototype.reduce() MDN documentation reallyFckingCuteEatingBaguette

lament rock
#

true

#

too lazy to open my mobile web browser

earnest phoenix
#

kek

earnest phoenix
#

Send me how

#

Send codes

#

Please@earnest phoenix

#

Hey

wheat mesa
#

How do I get my <a> element to fit the flexbox, so that when I hover over it, it changes the color of the whole thing, and not just part of it? (For the width of it, that is)

#

Sorry for the poor phrasing of that question, my brain is not running at 100% rn

earnest phoenix
#

@earnest phoenix you must see the docs or try to do it yourself

#

In your about me you have written you are Bot Developer but copying codes and running them doesn't make you a bot developer

#

You don't know basics too

lament rock
#

bind is a property of a function
function thing() {
console.log(this)
}
thing.bind("xd")() // prints xd

#

You may not DM me as there is no need to

wheat mesa
#

Well, there's no reason to DM someone for a development related question when there's a perfectly good development related channel to use for that

lament rock
#

I told you the answer to your question. It's up to you to figure out how that applies to your code

errant flax
#

basically evt.bind is not an existing function in evt

tame kestrel
#

well it looks like you're missing the start script

#

in your package.json try checking if you have your scripts setup to start your program

latent heron
#

@earnest phoenix

do { $this->reviewBot(self::cache, $item) as foreach($checklist as $item) }
while(self::queue_size < 0);
tame kestrel
#

and that's the path to the log

#

go for it

civic scroll
#

@earnest phoenix note: bind is assigned to objects, in this case you assign to evt's callback

#

basically that adds another parameter to the cb function

#

it's kinda late rep, sorry for ping KEKW

clever sorrel
#

alright

obsidian flint
#

@clever sorrel

#

in settings

clever sorrel
#

lemme see

obsidian flint
#

type each thing you added in .env

clever sorrel
#

wait so how exactly

#

?

obsidian flint
#

key: TOKEN value: lol nerd
then add

obsidian flint
clever sorrel
#

so

obsidian flint
clever sorrel
#

wait resend me the script

#

the like

#

wait

#

the TOKEN=no-token-for-you
PREFIX=ans!

obsidian flint
#

yes

clever sorrel
#

k

#

im getting mixed up

obsidian flint
clever sorrel
#

where do I make the .env script?

obsidian flint
#

no

#

wait

#

you made code in there?

#

yes

clever sorrel
#

yes

obsidian flint
#

add this thing in main folder, replace node index.js with your starting script

#

like node bot.js

clever sorrel
#

so

#

at the start of my index.js

#

i add that code?

obsidian flint
#

add the file

#

in there

#

don't rename

#

like

#

in the folder

clever sorrel
#

im confused

#

so

#

i download the file

#

then i put the file in the .env?

#

@obsidian flint

obsidian flint
clever sorrel
#

are you there?

obsidian flint
clever sorrel
#

OH

#

ok i think ik what you mena

#

mean

obsidian flint
clever sorrel
#

no wait

#

i ADD that file

#

then I change up the file to my settings?

#

@obsidian flint

#

hello?

#

@obsidian flint

#

are you there dude?

obsidian flint
#

tensing my brain

obsidian flint
obsidian flint
#

don't add to setting

clever sorrel
#

k

obsidian flint
#

in resources

clever sorrel
#

e

#

ill do this all later

#

im getting my brain too broken in the morning

bright thorn
#

is that possible to join a stage channel with music bot

#

?

obsidian flint
#

it's a channel

bright thorn
#

anyone

obsidian flint
bright thorn
obsidian flint
vale garden
#

hey

#

is it possible to get a guild, when the bot isn't on it?

#

apart from using it's invite link

#

so either its id or name

pale vessel
#

Nope

#

That's impossible

vale garden
#

oof

#

and what about getting user by username?

sick agate
#

If you somehow got the id it should work

vale garden
#

oh alright

#

thanks

chilly wagon
#

anyone top up diamond

pale vessel
#

For users, only IDs

vale garden
vale garden
obsidian flint
#

toxic mf***ker

#

sorry for being mean

#

but the fact that your name is that makes me feel cringe

pale vessel
#

Garena

obsidian flint
#

he's asking about the game rank btw

#

bs

obsidian flint
pale vessel
#

No

quaint wasp
#

how do I add something like a waiting function? So I would send a message saying something, wait some time, then edit it?

pale vessel
#

What do you code in?

quaint wasp
#

JavaScript

pale vessel
quaint wasp
#

so in there example,


setTimeout(myFunc, 1500, 'funky');
``` Its first running the function, then waiting, and then saying funky?
pale vessel
#

You can ignore the third parameter. It uses eval internally

quaint wasp
#

alright.

pale vessel
#

Just setTimeout(myFunc, 1500)

quaint wasp
#

But its basicly running the function after the set amount of time, right?

#

and the function here is myFunc

quartz kindle
#

ye

quaint wasp
#

alright, thanks.

#

I forgot how to async functions..

bright thorn
#
TypeError: Cannot read property 'guild' of undefined
    at VoiceWebSocket.onOpen (/home/ubuntu/real2/node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js:123:44)
    at WebSocket.onOpen (/home/ubuntu/real2/node_modules/ws/lib/event-target.js:144:16)
    at WebSocket.emit (events.js:376:20)
    at WebSocket.setSocket (/home/ubuntu/real2/node_modules/ws/lib/websocket.js:222:10)
    at ClientRequest.<anonymous> (/home/ubuntu/real2/node_modules/ws/lib/websocket.js:807:15)
    at ClientRequest.emit (events.js:376:20)
    at TLSSocket.socketOnData (_http_client.js:553:11)
    at TLSSocket.emit (events.js:376:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
#

anyone can explain

summer torrent
#

something before .guild is undefined

bright thorn
#

but

#

i this log i cant see where not defined

summer torrent
#

oh

#

you are probably using outdated version of discord.js

#

npm ls discord.js

#

and show output

bright thorn
#

hmm wait

#
discord-js-handler-template@1.0.0 /home/ubuntu/real2
ā”œā”€ā”¬ discord-reply@0.1.2
│ └── discord.js@12.5.1 deduped
└── discord.js@12.5.1
summer torrent
#

yeah

#

npm i discord.js

bright thorn
summer torrent
#

wait do you use template

bright thorn
summer torrent
quaint wasp
#

lmao

#

just do npm i discord.js

#

or define it in your package.json file in dependencies like this:

quaint wasp
#

Damn it my files arnt loading

#

umm

#

Ill try to type it here

#
dependencies: [
"discord.js" : "^12.5.1"
]```
bright thorn
# quaint wasp ```json dependencies: [ "discord.js" : "^12.5.1" ]```
{
  "name": "real",
  "version": "1.0.0",
  "description": "real bot for real army  For Questions: 3",
  "main": "real.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node real.js"
  },
  "author": "@!       Pukhraj#0581",
  "license": "ISC",
  "dependencies": {
    "@ksoft/api": "^3.1.9",
    "@top-gg/sdk": "^3.1.2",
    "ascii-table": "0.0.9",
    "common-tags": "^1.8.0",
    "cpu-stat": "^2.0.1",
    "discord-buttons": "^4.0.0",
    "discord-reply": "^0.1.2",
    "discord.js": "^12.5.3",
    "enmap": "^5.8.4",
    "erela.js": "^2.3.2",
    "erela.js-deezer": "^1.0.5",
    "erela.js-spotify": "^1.2.0",
    "ms": "^2.1.3",
    "os": "^0.1.2",
    "statcord.js": "^3.2.0",
    "topgg-autoposter": "^2.0.0"
  },
  "devDependencies": {
    "ascii-table": "0.0.9",
    "colors": "^1.4.0"
  }
}

quaint wasp
#

oh ya theres version 12.5.3..

#

also btw for start script you can just do node .

#

since . is your main file

earnest phoenix
#

what's the best way to control when the process stops?
im thinking of this:

function controlledExit() {
    if (process._controlled) return process._controlled;
    process._controlled = {
        interval: setInterval(_ => {}, Math.MAX_SAFE_INTEGER),
        stop() {
              clearInterval(this.interval)
        }
    };
    return process._controlled;
}
controlledExit();
brave garnet
#

I know that's offtopic but is there a way to connect bot made in d.py to a server and make api for this server using this bot? I already made bot account and linked empty website to add authorizing oauth...

slender thistle
#

@ripe prairie

quartz kindle
#

4 views lmao

ripe prairie
#

@mild gale dont advertise please

eternal osprey
#
  let tomute = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
  
    if(!tomute) return message.reply("**Couldn't find the selected user.**") 
    let muterole = message.guild.roles.cache.find(r => r.name === "muted");
    if (tomute.roles.has(muterole.id)) {```hey why am i getting the error: 
tomute.roles.has is not a function
sterile thicket
#

my code

module.exports = async(bot, message, args) => {
  execute(bot, message, args) {
  ...
  }
}```

error when starting the bot.
quartz kindle
#

you are mixing objects with functions

#

you probably want module.exports = {

sterile thicket
sly sierra
#

async execute

sterile thicket
sly sierra
#

np

solemn latch
brave garnet
#

;-;

solemn latch
#

It may help to learn how to make an api first, then making a bot use that api will be very simple.

brave garnet
#

Ok

sterile thicket
#

I'm doing this

const commandFiles = fs.readdirSync('./Others-Dir').filter(file => file.endsWith('.js'));
const command = require(`./Others-Dir/${file}`);
bot.commands.set(command.name, command);```
It says `file not defined`.

But now I have no clue what to define in the `const file`?
eternal osprey
#

hey i recently bought a nodemcu v3 controller. What can i do with it lmao?

quartz kindle
silent hornet
#

hey guys anyone use ytdl-core?

mild agate
#

Its a pain

long crow
#

Maybe just ask question, I used it before, switch to youtube-dl-exec

mild agate
#

Same

silent hornet
#

better?

long crow
#

And yeah, it a pain. Only limited to yt, and issues

silent hornet
#

bec I have some error

#

like 404 and 403 error

mild agate
#

Youtube banned/blacklisted your ip probably

#

Try using cookies

silent hornet
silent hornet
#

this ?

long crow
#

Iirc it the issue ytdl-core itself. Either use other package or you can try troubleshoot it

silent hornet
#

404 erro happen when I try to play restricted age video

long crow
#

Yeah, that is the one

silent hornet
#

but 2 days ago not error comes

#

there is a package that not provide all this problem?

tulip ledge
#

Question, I have a folder with item files this includes the base stats of that item, emoji, etc. Now would it be better to require that file once the user uses a command or require all item files and save them as a public object under the client?

long crow
silent hornet
#

😦

#

sad life

#

im coming crasy with this erorr 😦

gusty kestrel
#

@slender thistle yeh can u help here

#

The code stopped instantly

slender thistle
tulip ledge
#

So there's no more optimal solution between that?

quartz kindle
#

generally its good practice to load all the files a script needs at the top of the script

gusty kestrel
tulip ledge
slender thistle
#

That question implies I need to see your code

tulip ledge
#

Not all item files

tulip ledge
#

I'll just load all items in a public object undr client saves me some imports

gusty kestrel
#

Wait

quartz kindle
#

its a tradeoff, load all at the beginning = slower loading but faster execution

tulip ledge
#

Don't really care about the loading speed tbh

quartz kindle
#

load at command = faster loading but slower execution during the command's first run

long crow
#

I go for faster execution

tulip ledge
#

I'll go with option 1 then

split hazel
#

laughs with ssd

quartz kindle
#

ssd is still slower :^)

gusty kestrel
slender thistle
#

Code

#

not console

long crow
#

It's codensole KEKW

gusty kestrel
#

Wait

#

html?

slender thistle
#

Whatever code you edited

gusty kestrel
#

@slender thistle uhhh now wut?

slender thistle
#

I hope you do realize that I have zero fucking clue what your code is actually doing

#

hence why I asked for it

gusty kestrel
slender thistle
#

Why not just send your code and let me see how YOU run things

gusty kestrel
#

@slender thistle but my token will be revealed...

slender thistle
#

Then don't send it

#

You can just send specific code snippets which don't include your token

gusty kestrel
#

Ok

slender thistle
#

And, regardless, use environment variables to store your private crap

rocky hearth
#

is making a discord bot a backend or frontend work? Or it is something else?

solemn latch
#

Kind of both. But realistically it's only backend experience.
The discord client itself is doing almost all the front end work.

cinder patio
#

I'd say neither tbh

rocky hearth
#

so is it just an api?

cinder patio
#

It's a bot

#

it's not an API, it's an application which interacts with an API

tulip ledge
cinder patio
#

I'd say backend is an umbrella term

#

Most people consider a backend to be a server for a website

gusty kestrel
#

@slender thistle if I deploy on heroku will it stay online 24/7?

solemn latch
#

No

#

Heroku workers get less than a month of run time each month free.

Unless you pay there will be downtime

slender thistle
#

I thought we came to a conclusion that it was your code that's the issue and not the host

earnest phoenix
#

so its longer than a month

solemn latch
gusty kestrel
solemn latch
#

Looked it up. It's 1000 total with a card, which is plenty for one worker a month. Without it's 550 which isn't.

gusty kestrel
#

Ok

#

@solemn latch so how do I add it?

solemn latch
#

Add what?

gusty kestrel
#

Credit card

#

Just asking

#

For when I get one

solemn latch
#

Anyway it seems your issue isn't related to heroku. It seems your issue is code.

gusty kestrel
#

Ok

#

I need help in hosting 24/7 on repl@solemn latch

solemn latch
#

Repl runs 24/7 if you use a ping service. But it seems your issue is related to code, not repl.

worthy ivy
#

i cant access new mongodb data unless i restart the bot, how can i fix this?
i only have this piece of code to start the mongoose service thingy

#
const mongoose = require('mongoose')
mongoose.connect(process.env.MONGODB,{
  useUnifiedTopology: true,
  useNewUrlParser: true
}).then(console.log("Connected to MongoDB!"))
  .catch(console.error())
worthy ivy
#

like when new data is pushed, it cant be accessed unless the bot is restarted

gusty kestrel
#

And tell me what I have to correct

worthy ivy
#

stop pinging him every second bruh

gusty kestrel
solemn latch
#

Just a heads up, we don't allow clones of other bots on our site.

solemn latch
#

Seems you just admitted to using one

gusty kestrel
#

No for my own

gusty kestrel
#

My server

worthy ivy
#

then like i also have a schema file for config purposes

#

then the query itself (ithink)

#

.findOne() is technically quering the db right

#

since its finding somthing

solemn latch
#

it should be, thats weird.
Lemme take a look.

worthy ivy
#

so, example scenario
bot starts up, without the data
then user sets the data in a server
but then when the bot tries to access the new data, it cant find it

solemn latch
worthy ivy
#

if i restart the bot, then the bot can access the brand new data

solemn latch
worthy ivy
gusty kestrel
#

Uhh

#

Yo

#

Can u help me correct the code?

worthy ivy
#

like outside of any blockscopes

solemn latch
#

wait, so its being ran the one time at startup then?

gusty kestrel
solemn latch
worthy ivy
gusty kestrel
solemn latch
# worthy ivy you mean the query?

yeah, the query.
If you query outside any scope its only being ran the single time and never again. so it never can get anything new.

gusty kestrel
#

FOR MY OWN SERVER

worthy ivy
solemn latch
#

I genuinely don't know any good clones.

gusty kestrel
quartz kindle
#

why not just use an existing music bot?

gusty kestrel
solemn latch
#

^

worthy ivy
worthy ivy
gusty kestrel
gusty kestrel
worthy ivy
gusty kestrel
#

I wanna learn some codes

quartz kindle
gusty kestrel
solemn latch
#

if you want to learn, start from the beginning.

worthy ivy
#

well thats weird, its being executed everytime i need something @solemn latch

#

probably heroku being Pepega

#

i can access the new data tho weird

#

yep, it IS heroku being weird

#

wait no, its not

#

i just realised, a new document was made

#

then the query didnt get anythiing

#

er

#

ok so, i deleted the documents, but mongoose still thinks it still has the data?

#

is this probably cached or

cinder patio
#

what are you using to see the documents? Atlas, mongo cloud, etc?

cinder patio
#

Refresh to check if you've deleted them

worthy ivy
#

what the

#

its still there

#

ok now its gone

#

now its gone

#

???

#

what the

#

huh sometimes it works sometimes it dosnt..

#

yeah no i gotta solve this on my own, sorry for bothering

pliant needle
#

@solemn latch ads

solemn latch
#

@limber meteor please no ads

#

if you want to hire a developer, try fiverr

pliant needle
#

lmao wow, that escalated quite quickly

tulip ledge
#

Anyone knows why when I type /ping this event isn't triggering?

this.on("interactionCreate", (payload: Interaction) => {
      console.log("HEWO")
      SlashCommandHandler(this, payload);
    });
cinder patio
#

Just typing /ping will not trigger the event

feral aspen
#

What is interactionCreate?

#

I don't see it having a purpose.

#

Interaction, yes, the meaning is obvious.

#

How does it differ to message or messageCreate?

cinder patio
#

it's when an interaction is created

#

like when someone presses a button, or runs a slash command, or selects an item from a select menu

hexed sedge
#

Whats up cool people

sudden geyser
#

Hello fellow cool person

gusty kestrel
#

Is config file supposed to
.js
Or
.json

cold plover
crimson vapor
#

Ehh

modest maple
#

what ever you feel like

#

hell

#

call it config.fuck.me.plz mmLol

crimson vapor
#

Most people use json but fuck it

crimson vapor
#

A few people even use yaml for configs

gusty kestrel
cold plover
#

Use json its easiest.

crimson vapor
#

Env is different from json

crimson vapor
cold plover
#

Where are you hosting your bot? LUNAR

gusty kestrel
#

replit

cold plover
gusty kestrel
#

I'm using env vars

#

Soo

#

Can I use env var in json?

cold plover
#

İdk replit envs

crimson vapor
#

No

#

json is a data structure

gusty kestrel
#

Oh

#

So

#

How do I hide my token?

#

In config.json

crimson vapor
#

Env or use a config file

gusty kestrel
crimson vapor
#

No

#

not really

gusty kestrel
#

To hide it

heavy marsh
#

I have a bot [D.js V12]

Its on 11k+ guilds and sharded.
I have a join voice channel command - It works fine. But now when I run the command it tells me that the bot has join. But the bot doesnt join and no errors shown on the console.

crimson vapor
#

Env and JSON are not the same.

gusty kestrel
crimson vapor
#

then store the token in the env

#

and require it in your code

gusty kestrel
gusty kestrel
cold plover
#

If replit has envs just add your variables to env section

gusty kestrel
#

@crimson vapor

cold plover
#

And use variables as process.env.VARIABLE_NAME

gusty kestrel
#

I can't make env files

gusty kestrel
cold plover
#

No ofc

#

In config file

gusty kestrel
#

Alr

cold plover
#

Just call it by defining config file nd then

#

Config.token

#

Config.variablebla

sick agate
#

do not do it for creditanls

#

use that padlock icon for it

lyric mountain
#

they're just called "secrets" there

gusty kestrel
gusty kestrel
#

@cold plover how do I hide the token tho?

lyric mountain
#

use the secrets

#

secrets = .env

cold plover
#

Use them.

lyric mountain
#

except you do via interface instead of directly editing the file

#

but both are exactly the same thing

latent heron
#

does anyone know of docker connecting solutions for PHP via endpoints?

slender thistle
#
    teloxide::repl(bot, |UpdateWithCx { requester, update }| async move {
        //message.requester.send_photo(message.requester.chat, )
        let mut photo = requester.send_photo(
            update.chat_id(),
            InputFile::Url("https://cdn.discordapp.com/avatars/247741991310327810/a470516dd5db7b67f4c52afa95128be9.png?size=256".to_string())
        );
        photo.caption = Some("Yehee!".to_string());
        photo.send().await?;
        respond(())
    })
    .await;

this is so dumb

rocky hearth
#

I hv a circle div, I want to surround this div with 60 dots. How could I acchive this by css

earnest phoenix
#

hold up how tf did you get a circular div

rocky hearth
#

border-radius: 99999px

earnest phoenix
#

welp
border: thiccness dotted color

rocky hearth
#

was my initial thought too. But I can't limit the dots with that

earnest phoenix
#

changing the thiccness will affect how many dots there are

#

if you need more control use SVG

gusty kestrel
#

Wut is to be corrected

wheat mesa
#

I can't even read what that says

gusty kestrel
#

@wheat mesa

wheat mesa
#

You're using express in your package.json file.

#

It's a json file, not a js file

gusty kestrel
gusty kestrel
wheat mesa
#

no...

#

You're not supposed to use js code inside of your package.json file

#

package.json is for node to look at for information about your project and dependencies etc.

quartz kindle
#

code in package.json lmao

wheat mesa
#

It also looks like you haven't installed express through npm as well, judging by your dependencies...

#

Copy pasting code isn't going to do you much good, which is what I'm assuming you've done

split hazel
#

if you copy paste things enough times you start learning from it 😌

#

but it might be a long process

wheat mesa
#

eh, I wouldn't even say that

#

If you copy paste things but try to understand what they do, then that might work for learning a little

#

I feel like instead of copy pasting, actually writing out the code (even if it's a word for word copy) while trying to understand it is a better way to learn from it

#

But everyone learns differently ig

sudden geyser
#

You can learn well from either method

#

It depends on the person

gusty kestrel
#

Tell me how tk intsall then ig

wheat mesa
#

I highly doubt you downloaded code that had js code within a package.json file

wheat mesa
#

...

gusty kestrel
#

Experimenting

gusty kestrel
wheat mesa
#

You're getting a user object, and users have no roles associated with them

wheat mesa
#

Get a member object instead

#

np

wheat mesa
gusty kestrel
eternal osprey
#

hey not really much coding related, but does anyone know a good idea to implement in my bot? I am running out of ideas and want to do something that hasn't been milked out yet

#

i am hosting a multifunctional dc bot

slender thistle
#

I'm not sure how people have the audacity to call themselves bot devs when they struggle with the basic stuff

brave garnet
#

I generally have idea but not for a function only, for all the bot ;-;

wheat mesa
#

No

slender thistle
#

Have a read above and you'll see

wheat mesa
#

It's interesting because I often see people with the "bot developer" role having simple issues such as the above

#

Makes me wonder how they got the role

brave garnet
#

After pushing one bot to top.gg

eternal osprey
#

damn. If you are still struggling with what file extension you need to use....

wheat mesa
#

He was putting js code in a package.json file

#

lmao

eternal osprey
#

okay damn that one reaches deep.

slender thistle
wheat mesa
#

Lack of experience

#

To get the role you have to submit and get a bot approved, but then some of them will ask the most basic questions about bot development

#

And then their bio will be like "bot dev!"

eternal osprey
#

is the v13 djs beta already usable?

wheat mesa
#

You can use the master branch of djs for v13

#

Though it's not complete yet so some things might change upon official release

brave garnet
#

Hey, someone have maybe mobile version of replit to download? Official link broken

slender thistle
wheat mesa
#

yeah

slender thistle
brave garnet
#

Yeah but they have app and links broken

slender thistle
#

I just use a browser instead

brave garnet
#

In but there I can't copy paste

slender thistle
#

What does the app do that the website doesn't

#

Okay... let me see

brave garnet
#

Ok

slender thistle
#

Oh yeah that's a disaster

brave garnet
#

?

#

It is nowhere ? Uhh

gusty kestrel
#

@wheat mesa

eternal osprey
#

how can people even code on their phone

brave garnet
#

How u copy paste? I don't have these buttons on kboard

wheat mesa
#

Your curly brackets don't match up

gusty kestrel
eternal osprey
#

ah nice! You mange nice then.

wheat mesa
#

and you're missing a " on line 2

gusty kestrel
brave garnet
eternal osprey
#

will generate a new package.json with the desired packages.

gusty kestrel
#

Uhh what?!

brave garnet
#

;-; again...

wheat mesa
#

using npm init -y will generate a new package.json file that isn't messed up.

#

Or you could fix it manually

#

And I was wrong, your curly brackets do line up, sorry

#

You're missing a " before name on line 2

fair axle
#

I am using mongoose and created a schema but what is "_v"?

gusty kestrel
#

Alr

gusty kestrel
#

Where is terminal @wheat mesa

wheat mesa
#

Don't bother with the terminal for now

pale vessel
wheat mesa
#

Just put a " before name on line 2

pale vessel
#

You can ignore that

gusty kestrel
gusty kestrel
#

@wheat mesa

split hazel
#

you suffer on mobile

#

i'm amazed they even have some kind of mobile support

brave garnet
#

Gimme 2mins

old umbra
#

can i put a .js for my top.gg page?
I want to create variables to put img color palette etc and then get it by css

brave garnet
#

OK. I was thinking where this app is cause link broken. : https://replit.com/talk/announcements/Replit-Mobile-App-MVP/14496

replit

We did it! 10 days ago I created a post asking if people were interested in a mobile app for Repl.it. The answer in general was yes, and I set out to build the best possible thing I could. And I just released the MVP of the app. Here are some supported features: Creating and deleting repls and files šŸ“‚ Both dark mode and light mode 🌚 Integrate...

split hazel
#

oh lord

#

they probably gave up on it

brave garnet
#

?

#

So why constant updates YET?

brave garnet
split hazel
#

this doesn't even look official

#

so i'm not surprised they arent keeping the link updated

brave garnet
#

Look at comments also

eternal osprey
#

hey one little question, is it possible to host a browser-based personal assistant (i've used the built in browser js properties to set up voice recognition etc.) on the nodemcu esp8266?

quartz kindle
brave garnet
#

Ik but comments yet from this year

#

And error I have isn't 404 but unauthorised

#

And xml (or in-app unauthorised because I alr installed this "expo" for that)

#

These I have :

#

@quartz kindle @split hazel

split hazel
#

Well what are we supposed to do about it

#

They are the ones hosting the website

brave garnet
#

Idk. Have a raw .apk ?

split hazel
#

that's something you'd have to find yourself

#

but I doubt it

quartz kindle
#

if you check the comments, you will see that all the recent ones are complaining about the same problem

brave garnet
#

:/

split hazel
#

why can't you just use the browser version

#

it's probably much better than the app anyways

brave garnet
#

Copy paste not working. I don't have physical kboard

quartz kindle
#

im pretty sure they canceled the app and focused on making the browser version mobile friendly instead

split hazel
#

is it even official

brave garnet
#

No. Very unofficial and never exited beta

lyric mountain
#

what? discord is getting a mobile version for web?

quartz kindle
#

wut

brave garnet
#

No discord

quartz kindle
lyric mountain
#

meh

brave garnet
#

Anywaays - gimme 5 mins, OK?

split hazel
#

just tried it on mobile it works fine

brave garnet
#

I have Firefox, not chrome

#

And yes popup I have also but none of buttons really work for me

split hazel
#

sometimes you have to make sacrifices in life

#

why not use chrome for repl

brave garnet
#

Do u want to know my phone? It'll turnoff forever if I'd install...

#

Here ya have: laggy, buggy, modded for not losing it forever:

split hazel
#

how much storage do you have left

brave garnet
#

Storage? I have external SD

#

Many

#

But processor won't just run it. I have lags on discord, what bout chrome..

opaque acorn
#

(node:8692) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'channels' of undefined

#

help

brave garnet
#

Bruh, not channels but channel

opaque acorn
#

(node:9636) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'channel' of undefined

wheat mesa
#

You’re trying to read a property of undefined