#development

1 messages · Page 1800 of 1

earnest phoenix
#

Put $ at the end

#

yw

fresh verge
#

What does this mean?

earnest phoenix
#

like status 500 or something

dire harbor
#

hi im getting this error and im not able to fix it, can someone help me with this pls?

earnest phoenix
#

Tracks is undefined

dire harbor
#

ah it works now thx

spare badger
cinder patio
#

nope

prime mist
brazen wharf
#

iots just giving me a wierd arrow what is the probelm

bronze hollow
#

error while voting!

    at HTMLInputElement.<anonymous> (voting.js?13534371517:26)```
pale vessel
#

Try refreshing

brazen wharf
#

im so confused

#

refreshing didn't work

solid tide
#

Is learning data structures and algorithms nessary

brazen wharf
#

omfg im so retarded

#

I think i figured it ouit

#

nope nvm

marble juniper
bright thorn
#

From let cmd code is unreachable how ?

cinder patio
#

you return a value

#

so the rest of the code is not executed

quaint wasp
#

how can I check permissions if its not a function?

#

Gives me this: (node:42) UnhandledPromiseRejectionWarning: TypeError: message.author.hasPermission is not a function

#

I got this if(!message.author.hasPermission('MANAGE_CHANNELS')) { message.channel.send('Dude, you must have manage channels perms or else what are you even thinking?') }

cinder patio
quaint wasp
#

..

#

then how

#

bot?

pale vessel
#

No, member

quaint wasp
#

oh.

#

So i do
const member = message.author
and then use it or is it like already made?

clear marlin
#

no, you need to use

message.member.hasPermissions```
cinder patio
#

how does your bot have 10k users I dunno

quaint wasp
#

oh so its already made. Thanks

clear marlin
#

yes

quaint wasp
clear marlin
woeful pike
#

small brain: showing server count
big brain: showing total user count

clear marlin
woeful pike
#

if you don't understand how a user is different from member it would really help to learn about relational databases and relationship types

#

actually just learn about relational databases regardless

rocky hearth
#

I tried to install ffmpeg on mac with this brew install ffmpeg
I'm getting this error.

#

do I need to install python too?

lusty quest
#

yes, idk how its with the Build Tools you need on Windows and Linux

clear marlin
#

build tools is basically the xcode development tools

#

for anything like ffmpeg needs to have the xcode build tools installed in order to run primary audio functions

inner fulcrum
#

its 2021 and i cant make a ban command NICE

copper cradle
#

congrats

woeful pike
#

I wonder how many discord bots would be around if there were no huge abstraction libraries like discord.py

#

probably like 2% of the current amount considering how confusing the discord api is

inner fulcrum
#

.js is better

long crow
#

.js with all the any is fun

narrow fractal
#

Oofies

#

Its fun to use py

#

JS is interesting

inner fulcrum
#

i n t r e s t i n g

brazen stone
#

When does the weekend voting start/end or is it based on the users timezone? I know it's 'Friday to Sunday' but I want to display the weekend reward status in my bot

slender thistle
#

Friday 0000 to Sunday 2359, UTC

prime mist
lusty quest
#

it would not attract people like it does right now, but there will be people who would make it anyways

prime mist
#

Yeah I guess bots started as hacks around internal APIs.

Definitely wouldn't be as popular though.

vivid fulcrum
#

that reminds me when selfbots were still allowed

#

and even endorsed

earnest phoenix
#

Hello

prime mist
#

I have to say though, there is a point where you can over abstract something.

There are a couple of libraries around that have done this :)

small tangle
vivid fulcrum
#

yeah

#

this was way back

#

like cca 2016

stiff lynx
#

[root@NOVABOT2 novabotdrop]# node nova.js
internal/modules/cjs/loader.js:1057
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /root/novabotdrop/node_modules/canvas/build/Release/canvas.node)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1057:18)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/root/novabotdrop/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/root/novabotdrop/node_modules/canvas/lib/canvas.js:9:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)

#

idk what does this mean

#

pls help

lusty quest
#

did you have the build tools installed?

stiff lynx
#

git?

summer torrent
jovial elk
#

Anyone else encountered an issue with their bot, that suddenly it works everywhere except one server? it worked before in that server it just randomly stopped, and no error logs or anything wrong shows

Restarting the bot seems to fix the issue it, but is it a known issue or something?

stiff lynx
earnest phoenix
stiff lynx
#

/root/novabot/node_modules/@discordjs/opus

#

idk why I fail everytime installing discord opus

#

maybe the version is too old

#

git --version
git version 2.27.0

slender thistle
#

Rust, gtk, Windows
I can't for the life of me figure out how to get this error away no matter what I try to install. I've tried Google many times but nothing helped.

The error occurs when I run cargo run in my project directory.

jovial elk
# earnest phoenix It's related to sharding.

Hey, thanks for answering 🙂

Isnt sharding only a problem that need to be handled when the bot is in a large amount of servers? i think i read somewhere, its 2000 + servers when i need to shard?

slender thistle
#

Discord can sometimes shit itself for no apparent reason

earnest phoenix
slender thistle
#

Pretty much

jovial elk
#

@earnest phoenix @slender thistle i see, thanks for the answers :D, hopefully they fix that issue in 2.0

it only happened 2 times (2 month apart) so far that i know of because people reported to me, and restarting the bot solved it

earnest phoenix
#

np

slender thistle
#

It's an issue with Discord itself

#

Since Discord refuses to send you gateway events for one server, there's nothing really you can do I believe

earnest phoenix
#

Well they also have a stupid large bot sharding for bots with 150k guilds

jovial elk
stiff lynx
#

why I cant install discord@opus on my vps 😦

#

I'm gonna cry

#

npm install @discordjs/opus
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

@discordjs/opus@0.5.3 install /root/novabot/node_modules/@discordjs/opus
node-pre-gyp install --fallback-to-build

solemn latch
#

Looks like your npm install might be a little old/your lockfile is generated using a very old version of npm

solemn latch
#

update your install of node.js

stiff lynx
#

It is possibile that this package could not be supported by centos?

stiff lynx
#

node --version
v12.22.2

solemn latch
#

what about npm -v

#

as npm is what handles lockfile stuff

stiff lynx
solemn latch
#

ah yeah, lockfileversion 2 is after 7.0
npm install -g npm@latest might do the trick?

#

you may have to re npm i or even npm init after that.

stiff lynx
#

npm -v
7.19.1

#

I've got already the new version

#

OMG

tribal siren
#

Hey everyone! Recently I've been learning a lot about Slash Commands and Client API. So I want to make my bot to callback with an embed. However when I try to define my embed in the content section (through a variable). It shows me this error. Can you help me please?

vivid fulcrum
#

the embed isn't supposed to be in the content

tribal siren
#

Oh so like, components?

#

Or additions?

#

or whatever is there

vivid fulcrum
#

are you responding to the slash command?

tribal siren
#

well, yea

tribal siren
#

i think you provided tthe wrong url

#

o nvm

vivid fulcrum
#

that's the data obj structure in the response object

earnest phoenix
#

I need set up green discord button when any one press bot send server link

vivid fulcrum
#

stop crossposting your issue

#

you also need to be more descriptive

tribal siren
vivid fulcrum
#

to them

tribal siren
#

oh alright

#
const embed = new Discord.MessageEmbed()
  .setTitle('Три полоски')
  .setDescription('Адидас кроссовки')
                
client.api.interactions(interaction.id, interaction.token).callback.post({
  data: {
    type: 4,
    data: {
      content: 'Абибас',
      components: [
    {
      type: 1,
      object: embed
    }
      ]
    }
  }
})```
#

i clearly have brain damage

vivid fulcrum
#

tf

tribal siren
#

i tried doing something

vivid fulcrum
#

all you have to do is follow the structure that's in the docs

#

for instance, want the message to be tts? add a tts field in the data object and set it to true

tribal siren
#

oh shit

vivid fulcrum
#

same goes for embeds

tribal siren
#

i didn't scroll down lmao

#

let me try

#

i found tthis and tried

#
type: 4,
data: {
  content: 'Абибас',
  components: [embed]
}```
vivid fulcrum
#

stop using components

tribal siren
vivid fulcrum
#

literally read a few lines above that

tribal siren
#

didn't notice

vivid fulcrum
#

yeah

tribal siren
#

ok thanks

small tangle
#

does the permissions works differently on slash commands? because im responding with an embed and although i removed all permissions from my bot, he was still be able to send it? FeelsSmartMan

pale vessel
#

no

#

Hmm

#

Maybe check the channel permission overwrites

dusk narwhal
#

hello guys

#

i am ranveer

#

i am a bot dev i have a bot

#

i have 2 bot

#

Moon and Ranveer Soni Utlity

#

anyone can help me in development of my bot?

#

||i will be ur friend to XD||

agile atlas
dusk narwhal
#

ik

rocky hearth
dusk narwhal
#

wut

restive furnace
dusk narwhal
#

i kow

agile atlas
rocky hearth
#

does anybody has successfully made a music bot with discord.js@dev and @discordjs/voice?

signal estuary
#

Does anybody know why the bot doesnt return at this poin?
Code:

if(+max > +min) return
//max is 4 and min is 2

I also tried

if(Number(max) > Number(min)) return

But it doesnt return. Idk why
I already debugged but couldnt find out

sudden geyser
#

Can you show more of the scope surrounding that block of code?

signal estuary
# quartz kindle show more code
const errorLog = require('../common/errorLog.js')
exports.run = async (client, msg, args) => {
    console.log("Random")
    try {
        let min = args[0]
        let max = args[1]
        if(!min) return msg.channel.send({content: "``❌ Please mention a min number``"})
        if(!max) return msg.channel.send({content: "``❌ Please mention a max number``"})
        if(isNaN(min)) return msg.channel.send({content:"``❌ Please mention a real number``"})
        if(isNaN(max)) return msg.channel.send({content:"``❌ Please mention a real number``"})
        if(Number(max) > Number(min)) return msg.channel.send({content:"``❌ Max number must be bigger than min number"})
        msg.channel.send({content: "Your number is: " + Math.floor(Math.random() * (max - min) + min).toString()})
    } catch (e) {
        errorLog.logError(e)
        msg.channel.send({ content: "``❌ There was an error``" })
    }
}

quartz kindle
#

show the command you ran, and what the bot replied

signal estuary
#

Wait I am soo stupid

#

if(Number(max) > Number(min)) return msg.channel.send({content:"``:x: Max number must be bigger than min number"})

#

Look at this xD

#

If number mx is greater it returns that the max should be bigger than min xD

#

I am sooo stupid

quartz kindle
#

xd

autumn rampart
#
const Discord = require('discord.js');

module.exports = {
    name: 'resume',
    description: 'pauses a song/nasheed',

    async execute (client, message, args) {
        if(!message.member.voice.channel)  return message.reply('Pleases be in a vc to use this command.');
        const queue = client.distube.getQueue(message)
        if (!queue) return message.reply("Nothing in the queue!");
        await client.distube.resume(message)
        await message.channel.send("**Resumed Playing!**") 
    }
}
#

this does not work

slim heart
#

ok i seem to be getting a mass amount of errors from missing permissions for setting a users nickname, however im a bit confused how
i check to make sure my role is higher than the users highest, i check that i Manage Nicknames, and i check if the user is the owner
what else is there

vivid fulcrum
#

nothing

#

you have faulty logic in one of your checks

slim heart
#

nah im just dumb

#

to satisfy typings i only checked if db.log existed and it doesnt always

limber mica
#

What is the api refrence to send a message to a specific channel in a specific guild?

vivid fulcrum
limber mica
#

im talking something like client.guilds.cache.get('GUILD ID HERE').send(embed)

#

is that it /\

vivid fulcrum
#

then you should've noted you're using a library, you asked for the api reference

limber mica
#

discord.js

vivid fulcrum
#

and no, you can't send a message in a guild, you can send a message in a channel

limber mica
#

so client.guilds.cache.get.(GUILD HERE).channels.cache.get('CHANNEL ID').send(embed)?

vivid fulcrum
#

yup

#

you have a syntax error in there though

opal plank
#

TS would scream at that tho

#

cuz .get() might return undefined

limber mica
#

.find()?

opal plank
#

if ur id is wrong or u dont have channel/cache

#

no, get is fine

#

but u should add fallbacks

#

like fetching the channel if its not cached

limber mica
opal plank
#

or stopping if a guild isnt available

limber mica
#

im copying the ID directly from firebase so i know its correct

opal plank
#

thats precisely the problem

#

databases dont update along with discord

#

so if a channel is deleted

#

now what?

#

do u check for that?

pale vessel
#

you can skip getting the guild and use client.channels.cache.get()

limber mica
#

and the channel is my private server

opal plank
#

if u dont have a channel cached, do you get that?

vivid fulcrum
opal plank
#

well yeah, still tho

opal plank
#

thats a route too

opal plank
#

but at the end of the day, the errors will come on ur bot

#

not on the end user

#

so the only one negatively affected by this is u

#

specially if u get too many errors

#

cloudflare might ratelimit u

limber mica
#

cloudflare?

#

u mean firebase?

opal plank
#

no, cloudflare

#

if ur bot sends too many errors to discord, it will get ratelimited

limber mica
#

when does cloudflare come in

opal plank
#

u have a quota per day of errors

limber mica
#

ohhh

opal plank
#

cloudflare is proxies for discord, it passes thru it before

limber mica
#

i dont send errors to discord, unless disc.js does

vivid fulcrum
#

can't believe this was in 2019

#

doesn't feel like it at all

opal plank
#

i feel you

limber mica
#
client.guilds.cache.get('857312635585429504').channels.cache.get('860537456020684830').send(embed2)     
                                                                         ^

TypeError: Cannot read property 'channels' of undefined
    at ReactionCollector.<anonymous> (N:\Desktop\ColdRP bot\commands\requestaccess.js:62:74)
    at ReactionCollector.emit (node:events:381:22)
    at ReactionCollector.handleCollect (N:\Desktop\ColdRP bot\node_modules\discord.js\src\structures\interfaces\Collector.js:100:12)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
#

BRUH

opal plank
#

not like i didnt warn you

#

u dont have fallbacks nor any checks

#

Typescript would've yelled at you the moment you typed that

limber mica
#

how do i force the bot to cache it

pale vessel
#

the guild should be cached

#

That's weird

opal plank
#

either a fat discord.js caching moment, or they copied the wrong id

limber mica
opal plank
#

use detritus

#

like i said, add fallbacks

pale vessel
#

and again, just use client.channels.cache or even better, client.channels.fetch()

limber mica
opal plank
#

it aint

pale vessel
#

You don't need the guild to get the channel

wheat mesa
#

no such thing

limber mica
#

omg i forgot about fetch

opal plank
#

technically you dont need the channel at all

#

u can just send a rest request

pale vessel
#

you need the ID

#

that's all

opal plank
#

the id, yes

#

not the channel itself

pale vessel
#

then client.api.channels[id].messages.post({ data: { embed } }); or something

limber mica
#

so my code should look like this

try{
await client.channels.fetch('860537456020684830').send("Type-script and detritus are bad")
} catch {
console.log(err)
}
pale vessel
#

await the method

#

and you should handle the error it might throw

opal plank
#
<rest>.raw.post({
  body: {
    content: 'Hello world',
  },
  route: {
     path: 'channels/channelId/messages',
     params: {
       channelId: '123456789012345', 
     }
  }
})```
limber mica
opal plank
#

you need rest

limber mica
#

why

opal plank
#

cuz d.js doesnt add features the day they come

#

so you're either stuck with using the api docs, or waiting for them to add it

limber mica
#

Dont you dare say deterius does

opal plank
#

it do

limber mica
#

for the love of god

pale vessel
#

Cake adds a feature the day it releases!!!!!!!

opal plank
#

^^^^

#

before even

pale vessel
#

True doe

opal plank
#

let me check rq

#

just for reference

limber mica
#

join general so i can show you how much of a b***ch it would be to change it to detritus

#

wait

#

i cant stream

#

lmao

#

There is more as well

wheat mesa
#

that's not THAT much

woeful pike
limber mica
#

There is a lot more

#

A LOT MORE

wheat mesa
#

if you talk to Erwin he'll make you want to use detritus regardless of whether or not it's actually useful to you

pale vessel
#

can you send messages using WS

limber mica
#

@opal plank convince me its worth it

limber mica
pale vessel
#

ok no

pale vessel
#

you need REST

opal plank
#

May 30 is when he added menus along

#

the dropdowns

pale vessel
#

coolio

limber mica
#

WAIT WAIT WAIT

#

DROP-DOWNS

opal plank
#

we had dropdowns for almost 2 months now

limber mica
#

hol up

#

no

opal plank
#

just could use unless you were in a whitelisted guild

limber mica
#

i must resist

#

no detritus

#

im too lazy to switch

pale vessel
#

not like you could use it back then since you needed to be whitelisted

woeful pike
#

to make a single api call or switch a library your codebase is built around and rewrite the whole thing hmm very difficult decision indeed

opal plank
limber mica
#

Why cant all functions just by default be async

opal plank
#

you'd love deno

#

doesnt deno wrap everything in async?

#

top level await

limber mica
#

I do minecraft server setups

#

For very cheap prices and i can beat the competitors

#

Sorry just had to plug myself there

#

Is there ANY WAY to make a switch statement async?

opal plank
#

what

pale vessel
#

Wrap it in an async function

vivid fulcrum
#
async switch(var) {
  await case case1:
    break;
} 
#

/s

opal plank
#

massive brain

limber mica
#

My router just comitted die

vivid fulcrum
#

yes you can

opal plank
#

thats what the /s stands for

limber mica
#

; expected

vivid fulcrum
#

red means it worked

wheat mesa
#
await async switch(var) {
  async () => {
     await case case1:
      await break;
}
await return
vivid fulcrum
#

callback hell v2

wheat mesa
#

more async please!

limber mica
#

Lol

wheat mesa
#
await swapBotToDetritus();
limber mica
#

My wifo card just fried itself after i installed detritus

#

Its so bad it broke my pc

opal plank
#
async switch(true) {
  await case true: 
      await var.forEach((any) => {    
         if(any === 'case1'){};    
         if(any === 'case2'){};
         if(any === 'case3'){};    
         if(any === 'case4'){};    
      })
    break;
} ```
i improved ur code @vivid fulcrum
#

how to properly use switches

untold token
#

await letPeopleUseWhatTheyWant()

opal plank
limber mica
untold token
#

Me too

limber mica
#

I cant do code blocks :(

untold token
#

You can

limber mica
#

I tried

wheat mesa
#

The mobile keyboard doesn't have backticks on some phones

limber mica
#

#

Thats all i have

wheat mesa
#

you can still copy paste though

untold token
#
return see ? “I” : “can”
opal plank
#

imagine using default keyboards tho

untold token
opal plank
#

flesky or some other app keyboard have amazing themes n shit

#

plus they can have custom buttons if u want

limber mica
#

magic

untold token
limber mica
#

Omg

untold token
#

Yes yes

#

Very good

vivid fulcrum
#

gboard >

limber mica
#

Were on the same phone xd

untold token
#

11 pro here

limber mica
vivid fulcrum
#

the only thing i dont like about gboard is the fact that they removed built-in search

lament rock
#
methods[(await Promise.resolve("managedLibsAreTrash"))]();
opal plank
#

havent used that

#

flesky is a good deal for me rn

limber mica
untold token
#

Jailbreak

earnest phoenix
#

pls give me link of discord button website

#

i need check how make

opal plank
#

since i may have talked to the devs quite a bit so they give me free shit

lament rock
#

Don't use discord-buttons

limber mica
lament rock
#

Discord.js has them natively

vivid fulcrum
limber mica
wheat mesa
#

detritus has buttons right?

opal plank
#

for almost 2 months now, yes

#

3 actually

wheat mesa
#

I need to swap

untold token
opal plank
lusty quest
#

doesnt it already support the dropdown stuff?

untold token
#

14.3

wheat mesa
#

What good is a library if no one supports it by using it!

#

Might as well

limber mica
untold token
opal plank
#

thats what ComponentSelectMenu is for

woeful pike
untold token
#

Hi xet

woeful pike
#

hello

opal plank
#

using if/else on a switch

#

could've await'ed the rest tho, can never have enough awaits

woeful pike
#

yandere dev moment. Use switch = codebase immediately fixed

earnest phoenix
#

not officeal

opal plank
#

exactly

vivid fulcrum
#

well, you asked for the discord website

earnest phoenix
#

i need soem thing

opal plank
#

ditch forEach and use for...of = 127% performance increase

earnest phoenix
opal plank
#

what?

#

like discord-buttons package?

#

or u want an example of someone using buttons?

#

i dont get it, cry sent u what u asked for

#

a discord button website, technically

#

does he mean widgets?

#

like guild widgets/badges?

#

so many questions

#

cannot compute, shutting down

wheat mesa
#

I mean, last night he was spamming the same error message over and over

#

So we need more information

near stratus
wheat mesa
#

Linus 😉

untold token
limber mica
#

Sorry erwin

wheat mesa
#

What's wrong with learning a little ts!

limber mica
#

I hate TS with my heart and soul

#

it is so frustrating and confusing

wheat mesa
#

...have you used it?

limber mica
#

Yes

#

And it sucked

wheat mesa
#

Personally I haven't used it

opal plank
wheat mesa
#

Just looks like strongly typed js

#

personally I like that idea

opal plank
#

u can use js, i told you multiple times

limber mica
#

The documentation says otherwise

opal plank
#

its like eating a cake, vs eating a cake with confetti , icing, and cherry ontop
its still cake

#

bad example, but u get the idea

lusty quest
#

you just used cake bcs of cake right?

opal plank
#

its just that we, who use typescript, get a lot more neat shit ontop

opal plank
wheat mesa
#

Learning a strongly typed language is also never a bad thing

opal plank
#

if u ever plan to switch to another language, knowing how strong typed objects/varaibles work will greatly reduce the amount of things u need to learn

#

@limber mica but the point stands, u dont need ts to use detritus

lusty quest
#

i dont like TS, but use it to give it a try, for now i would still prefer js over TS bcs js usually just works and dont get caught on stupid errors that are only there for the compiler

vivid fulcrum
#

typescript catches type errors you can fix in 2 minutes instead of struggling for 2 hours to fix a type error in production js code

opal plank
#

^^^^

#

there IS a bit of intial investment

#

but it pays off

#

that investment is in form of more code(aka u need to type your objects/variables) and some rare times, fighting with typescript toget shit to work

vivid fulcrum
#

plus ts is just prettier to look at

opal plank
#

but it saves u from having to wait days until eventually someone randomly stumbles upon a bug

wheat mesa
#

I love the look of ts

opal plank
#

ts is bae

woeful pike
#

I mean that still happens but it's more rare with ts

opal plank
wheat mesa
#

Just so much more structured

woeful pike
#

my blog is in js cuz there's 0 important business logic but for everything else, ts good

opal plank
#

xet, u might be able to gimme a hand on what i was struggling with yesterday

#

with declarations

vivid fulcrum
opal plank
#

this basically

vivid fulcrum
#

very nice to work with

limber mica
#

bruh i cant add async to a switch case

opal plank
wheat mesa
#

Oh no...

opal plank
#

the code u putting in it is

#

async only works for promises

limber mica
#

oh

opal plank
#

its like saying my console log is async

#

like what?

#

not how it works

#

but either way

#

make a function

#

and call ti after

limber mica
#

its fine i got it working

woeful pike
#

seems like a classic case of classes bad

opal plank
#
console.log(hi);
continueStuff();


async function continueStuff() {
  switch(a) {
    case 'a': await console.log(await 'hi');  
  }
}

stupid example, but u get the point

limber mica
#
N:\Desktop\ColdRP bot\commands\requestaccess.js:62
                            client.channels.fetch('860537456020684830').send(embed2)

TypeError: client.channels.fetch(...).send is not a function
opal plank
#

lost a tuff of hair doing that

opal plank
#

another issue where ts would tell you

limber mica
#

stop with TS please

opal plank
#

now u starting to see our glory

limber mica
#

im dying

opal plank
#

that DOES work

#

you wrap ur async code inside a function

limber mica
#

{
"resource": "/N:/Desktop/ColdRP bot/commands/requestaccess.js",
"owner": "typescript",
"code": "1359",
"severity": 8,
"message": "Identifier expected. 'switch' is a reserved word that cannot be used here.",
"source": "ts",
"startLineNumber": 42,
"startColumn": 32,
"endLineNumber": 42,
"endColumn": 38
}

opal plank
#

and call ir right after

#

show what u got rn

#

like, full context

limber mica
#

wait

#

hold on

opal plank
#

it says the exact line

#

"startLineNumber": 42,
"startColumn": 32,
"endLineNumber": 42,
"endColumn": 38

limber mica
#

hold on

opal plank
#

"resource": "/N:/Desktop/ColdRP bot/commands/requestaccess.js", and where it happened

limber mica
#

HOLD ON

opal plank
limber mica
#

so ive got progress

opal plank
#

cuz legit, changing classes at this point will be a pain

limber mica
#

So its not erroring but the switch statement is not working with the reaction collector

opal plank
#

thats just a small example, but changing the structure from classes will legit require a chuky rewrite

limber mica
#

So when i react it does nothing

opal plank
#

another great thing from vsc, a debugger

woeful pike
#

I don't really understand what you're trying to do. Update the type signature of a constructor or what?

opal plank
#

see whats going on when you click ona button

opal plank
#

the end-goal is have it so whenever the library emits a <Message>, it has what i added onto the intial class

#

that code does the trick

#

it transpiles AND compiles file

#

however VSC does not like it one bit

#

and its one of those instances where ts-ignore just doesnt rid of the error

limber mica
#

Im dying

#

Like, really bad

#

My collector is not working

#

wait

#

ok, so i know why my first thing was not working

#

but im confused now

near stratus
#

umm dude

#

wtf

limber mica
near stratus
#

Just wrapping the code in async function won't make it magically work

#

You have to call the function later

limber mica
#

So how would i go about that?

opal plank
#

thats going to be on chonky gif

#

@woeful pike hopefully its visible enough

near stratus
opal plank
#

open in browser

#

i just opened it, looks fine

wheat mesa
#

On mobile rn, that’s probably why

opal plank
#

even ts-ignore doesnt rid that

#

but its compiles just fine

#

and if i switch to implements, the it no longer has property

digital ibex
#

Hi, I have: ```js
function sendData(e) {
e.preventDefault();

              const xhr = new XMLHttpRequest()
              xhr.open('POST', '/guilds/<%- id %>/automod');
              xhr.setRequestHeader('Content-type', 'application/json');
              
              const ignoredChannel = document.getElementById('ignoredChannel').value;
              const ignoredRole = document.getElementById('ignoredRole').value;
              const blacklistedWord = document.getElementById('add-word').value
              const automodModule = document.getElementById('automod-module').value
              const ignoreMod = document.getElementById('ignore-mod').value
              let wordsInDiv = '1';
              let channelsInDiv = '1';
              let rolesInDiv = '1';

              if (document.getElementsByClassName('blacklistedWord').value !== '1') wordsInDiv = document.getElementsByClassName('blacklistedWord').value;
              if (document.getElementsByClassName('ignoredChannels').value !== '1') channelsInDiv = document.getElementsByClassName('ignoredChannels').value;
              if (document.getElementsByClassName('ignoredRoles').value !== '1') rolesInDiv = document.getElementsByClassName('ignoredRoles').value
              
              const data = { data here }

              xhr.send(JSON.stringify(data));
           }
opal plank
#

cuz its not a class, technically

vivid fulcrum
#

why are you not using the browser fetch api

#

xhr is ancient

digital ibex
#

and wheneer "wordsInDiv" is sent, the page refreshes for some reason, any idea?

#

ik

sudden geyser
#

codecademy still trying to teach xmlhttprequest

vivid fulcrum
#

it's literally older than me

digital ibex
#

u kno y the page is refreshin tho?

vivid fulcrum
#

also

#

you should probably switch to a SPA for something like this

#

you seem to have a lot of states you need to manage

limber mica
#

Still dont work and im dying

digital ibex
#

oh

#

but u kno whas goin on wid it

#

?

near stratus
limber mica
#

In the .then statement it is triggering and firing the console.log statement but not the function

near stratus
limber mica
#
collector.on("collect", (reaction, user) => {
#

Yes

wheat mesa
#

...are you sure?

limber mica
#

The second one popped up in the console

wheat mesa
#

Ok, just making sure

earnest phoenix
#

what probleam

limber mica
#

My function is also grayed out

wheat mesa
#

Then it’s not being called

earnest phoenix
near stratus
# limber mica

I don't know why the code isn't breaking
but it should break
If I was the interpreter / Compiler I'd surely break
When you did client.channels.fetch('860537456020684830').send(embed2)
From no direction this should work

#

IDK why it isn't showing errors

#

But it should

#

cuz client.channels.fetch('860537456020684830') will return a Promise

#

and you can't .send to a promise

#

until it's resolved

limber mica
#

"'stroke' is declared but its value is never read"

near stratus
#

and you didn't wait to get resolved

wheat mesa
limber mica
near stratus
#

also what is waffle ?

limber mica
wheat mesa
#

Wait a second...

near stratus
#

nvm

near stratus
limber mica
near stratus
clear marlin
#

Guys, angular vs react

wheat mesa
#

react

#

don't even ask that question

clear marlin
#

and why

near stratus
#

use this

client.channels.fetch('860537456020684830').then(channel => { 
    channel.send('Whatever')
})
near stratus
vivid fulcrum
#

react

clear marlin
#

but like why

near stratus
clear marlin
#

lmao

#

and what's your thoughts on vuejs

vivid fulcrum
#

vue is definitely the most simplistic

clear marlin
#

vue > react or no?

near stratus
clear marlin
#

hmm,

vivid fulcrum
#

want x? do x and it works exactly like you want it to

while in angular and react you need to do y and z in order to achieve x

clear marlin
#

alright well, thanks!

vivid fulcrum
#

vue is very good but i still prefer react

limber mica
#

IT WORKS

eternal elbow
limber mica
near stratus
eternal elbow
#

Why

near stratus
#

cuz it's node.js not deno

clear marlin
#

alright, deal. I'm using react

near stratus
eternal elbow
clear marlin
vivid fulcrum
#

oh also, some really good news about react 18

#

they're adding automatic state batching

eternal elbow
#

But using then() creates inception

vivid fulcrum
#

so when you need to update 2 or more states, you won't spam re-renders (in hooks ofc)

clear marlin
#

like

import(`file.txt`).then(data=>{
}).catch(err=>{
console.log(err);})

Rather than

const fileData = await import(`file.txt`);
#

but then, there's a problem

#

you can't use, data outside of the .then() statement

#

whereas you could use fileData anywhere in the program

eternal elbow
near stratus
vivid fulcrum
#

lol redux 🤡

near stratus
#

tbh I never saw any react tutorial not ending with redux

vivid fulcrum
#

because up until recently it was really the only decent choice for global state management

#

now we have react context and recoiljs

near stratus
#

wait we do ?

#

*goes googling

vivid fulcrum
#

react context is native to react and most of what redux does can be replaced with react context

#

if you still need global state management, use recoil

#

it's so much more user friendly and simplistic

#

recoil is also designed by facebook themselves

eternal elbow
#

I don't know exactly how good it is but for me "mern" is the best

#

There is an unrelated problem, if I remember correctly, there was a function called dispatcher.seek(ms) in v11, what happened to it?

sudden geyser
bleak ingot
earnest phoenix
#

Not related to this channel. You can ask in #support

proud plover
#

any .js user ?

#

if yes dm me

sudden geyser
#

Just ask your question pls

proud plover
sudden geyser
#

Does it involve fixing an issue (e.g. a command not working as expected)?

proud plover
#

its nothing like that

bleak ingot
#

sorry

coarse topaz
#

Hey there, I've a question
Is it possible to mass-clear reactions from all the messages in one channel in discord.js? If so, how?
Thanks

#

(Please ping me when responding)

lyric mountain
#

plausible? no definitely not

coarse topaz
lyric mountain
#

because ratelimit exists

#

you're going to hit it constantly when clearing reactions of a whole channel

coarse topaz
#

Or does rate limit still exist in that case?

lyric mountain
#

it does

#

because
A - You're still fetching messages
B - You're still clearing reactions

#

everything regarding the api has ratelimit

tulip ledge
#

Technically you could make an interval loop eg 1 second and you'd be ratelimit free, it will be alot slower tho

lyric mountain
#

also, iirc, you can only fetch messages up to past 7 days

tulip ledge
#

14 days I think

tulip ledge
#

I mean

#

u could do the math

#

how many actions u have to do a second and then check the ratelimit

#

and set the interval so u just about don't hit the ratelimit

graceful shore
#

how do i check a channels topic

pale vessel
#

The topic property...?

graceful shore
coarse topaz
# tulip ledge 14 days I think

Oh uh then it's kinda impossible I think? Those channels don't have more than +30 messages for sure, but some of them are really old...
Isn't there a way I can clear reactions in an automatized way? Those're vote channels, where people vote for their favorite stuff by reacting to the messages...

cinder patio
tulip ledge
modest crane
tulip ledge
modest crane
#

the 14 days limit is for deleting messages

tulip ledge
#

oh yeah

#

but u sure it's not for fetching?

modest crane
#

yup

coarse topaz
cinder patio
#

If the channel has only 30 messages then you should be able to fetch them all at once and iterate through them yeah

pliant copper
#

How to replace characters from JSON file in python? I tried this but doesn't work

list = json_data["players"]["list"]
list = list.replace("[", "")
list = list.replace("]", "")
list = list.replace("'", "`") 
coarse topaz
#

Woah that's amazing! Thanks!

woeful pike
pliant copper
#

Ye

woeful pike
#

ur variable is already a list

#

also don't name things list

pliant copper
#

I want to remove these [ ] '

woeful pike
#

that's already a list you need to loop through them and format the names accordingly

pliant copper
#

The list is not fixed so idk how to do it

woeful pike
#

string.join probably

pliant copper
#

I get the info from a website in json so it has a layout

woeful pike
#

right, look up string.join

brave pulsar
#

@pliant copper

#

do you still need help?

#

what is the end goal

pliant copper
#

Ye, well I wanted to try make a bot which shows mcserver status but I have no idea how to remove these [ ] ' from players list

brave pulsar
#

ok so

#

its a list

lyric mountain
#

those [] don't exist at all

brave pulsar
#

and

#

so

#

@pliant copper

#

all you have to do is

pliant copper
brave pulsar
#

", ".join(list)

#

and this will join the list

#

making it an str

#

and put a , in between each value

#

so py food = ['apples, 'pears', 'potatoes'] print(food)
this here ^ prints ['apples, 'pears', 'potatoes']

food = ['apples, 'pears', 'potatoes']
print(", ".join(food))```
this here ^ prints `apples, pears, potatoes`
#

is that what you want?

#

there are actually many methods

#

you can also do food[0:len(food)]

earnest phoenix
#

Yikes, that's just gonna copy the list

brave pulsar
earnest phoenix
#

food[:] >>

brave pulsar
#

ignore the len part

pliant copper
#

Yes, and not to be rude but I'm new to coding so can you add that to this?

List = json_data["players]["list"]

The one you send prints it but I wanna use it in embed

#

As a value

brave pulsar
#

uh

#
embed = discord.Embed(title="Players online", description=f'**Players:** {", ".join(List)}')
pliant copper
#

Tysm it works

earnest phoenix
#

I mean, they don't

lyric mountain
#

oh, python is case-sensitive?

earnest phoenix
#

always has been

pliant copper
#

@Fred123#7205

earnest phoenix
#

You can't do "{""}" but you can do "{''}"

#

f"{""}" to be exact, since it's gonna get concatenated anyway

pliant copper
#

I'm gonna add another field then

earnest phoenix
#

It's not gonna fix anything

#

f"{", ".join(...)}" is interpereted as f"{" and ".join(...)}". Use single quote so that the string continues

#

Also, why are you still shadowing built-in list?

graceful shore
#

can someone help?
my bot keeps crashing when someone sends a image with no message


if (!message.channel.name.includes("_rem")){
const channel = message.member.guild.channels.cache.find(channel => channel.name === "uwulog");
if(channel && message.content && !message.attachments.first()){

const botlog = new Discord.MessageEmbed();
botlog.setTitle(`Log`);
botlog.setColor('#ae00ff')
botlog.addField("#"+message.channel.name + " < User ID:" + message.member.id + "> " + message.member.user.tag + ":⠀" + message.content + "⠀", "⠀");

channel.send(botlog).catch(()=>{ channel.send("Could not send log message")});
}
}
#

i have no idea what is causing it

stiff lynx
#

pls, help with this

#

I'm trying to install discord opus on my vps

sudden geyser
#

so make wasn't found

graceful shore
#

im so confused

mental furnace
#

you dont have the tools to compile packages

#

distro?

#

@graceful shore

graceful shore
mental furnace
#

you need to install the compiling tool

graceful shore
#

... why?

mental furnace
#

aka: make

#

because a normal user normally doesnt have to compile anything

#

so they dont come bundled

graceful shore
#

im not trying to compile anything

#

im trying to fix and embed error

mental furnace
#

you are

mental furnace
#

wait

graceful shore
#

ur looking at the other guys question

mental furnace
#

I WAS LOOKING AT THE WRONG MESSAGE

graceful shore
#

well done XD

mental furnace
#

replace js channel.send(botlog).catch(()=>{ channel.send("Could not send log message")}); with js channel.send(botlog).catch(e=>{ channel.send("Could not send log message\n> " + e.message)});

#

it should give you some info on whats wrong

wheat mesa
#

The first parameter of channel.send does not take an embed!

mental furnace
#

thats also not the error i think

wheat mesa
#

Try channel.send({ embed: botlog })

mental furnace
wheat mesa
#

Yeah, might not be, but it'll still cause problems in some cases

graceful shore
mental furnace
#

you cant just have whitespaces

#

also isnt the third parameter a bool?

graceful shore
#

it works but it only crashes if the message content is only an attachment

digital ibex
#

Hi, for some reason im gettin this error: TypeError: Index is not a contructor

graceful shore
digital ibex
#

and i dont know why, when Index is a class

mental furnace
#

wait there ISNT a third parameter

#

what the fuck am i looking at

wheat mesa
digital ibex
#

ye

mental furnace
graceful shore
#

yes

#

probably didnt need the last + "⠀" in field name but oh well

digital ibex
#
class RandomGenerator {
// class
}
module.exports = RandomGenerator;
mental furnace
#

i will jst say discord.js is broken and leave

#

i mean i might just ping erwin to receive a 10 paragraphs of messages saying how detritus is better

#

but it REALLY looks like a d.js issue

graceful shore
#

i had it working before in a older version of my code

graceful shore
#
if(!message.content) return;
if(message.content.length  <= 86){
const botlog = new Discord.MessageEmbed();
botlog.setTitle(`Log`);
botlog.setColor('#ae00ff')
botlog.addField("#"+message.channel.name + " < User ID:" + message.member.id + "> " + message.member.user.tag + ":⠀" + message.content + "⠀", "⠀");

const channel = message.member.guild.channels.cache.find(channel => channel.name === "uwulog");
if(channel){
channel.send(botlog);
}
}

if(!message.content) return;
if(message.content.length  >= 86){
const botlog = new Discord.MessageEmbed();
botlog.setTitle(`Log`);
botlog.setColor('#0xff0000')
botlog.addField(message.url + " message was over 86 characters and could not log.", "⠀");

const channel = message.member.guild.channels.cache.find(channel => channel.name === "uwulog");
if(channel){
channel.send(botlog);
}
}
#

it used to look like this

#

thats before i tried catching errors

digital ibex
mental furnace
#

im ok with codeblocks

#

just

#

WHY is your code flat

graceful shore
mental furnace
#

where indentation

graceful shore
#

oh

mental furnace
wheat mesa
#

smile to hide the pain 🥲

slender thistle
#

If you used python you wouldn't have this problem

digital ibex
#

300 lines wtf

mental furnace
graceful shore
#

i may use notepad instead of visual studio cuz i cant wait 3 seconds for it to load dont kill me

mental furnace
digital ibex
#

thats not something u wanna brag about but ok

#

lol

mental furnace
#

FOR JAVASCRIPT

wheat mesa
#

I prefer vsc for js stuff

#

But vs for c# stuff

mental furnace
#

i shouldnt have come here

graceful shore
slender thistle
#

Use VSC instead

mental furnace
#

first its a guy who doesnt even have make

digital ibex
#

waffle, any idea on my issue?

mental furnace
#

and then some genius who uses notepad

sudden geyser
#

what about emacs

mental furnace
#

never used it

graceful shore
slender thistle
#

VS is preferred for stronger stuff like C languages

wheat mesa
mental furnace
#

no loading time

#

intellisense

#

DEBUGGING

graceful shore
#

im literally using that

#

im using vscode now

#

happy?

mental furnace
#

Visual Studio != VSCode

digital ibex
#

oh im sorry @wheat mesa i forgot to push my updated code... :/

slender thistle
#

Visual Studio and Visual Studio Code ain't the same

mental furnace
#

way too different

wheat mesa
#

module.exprts is a problem probably. (unless that's a thing, never seen it written like that before)

digital ibex
#

ik ik :///

mental furnace
#

VS and VSC is like how C is JavaScript

wheat mesa
#

oh okay

digital ibex
#

i forgot to push the code shit

graceful shore
#

ok im using vscode

mental furnace
#

good for you

#

hope you opened the folder instead of the single file you are editing

wheat mesa
#

Your problem is that Index is not a class name

#

Your class is titled RandomGenerator

#

Your file is named index.js

#

But you cannot create an object of your index.js file, you need to create an object of the RandomGenerator class

digital ibex
#

its old code

digital ibex
#

im jus pushin the new code

#

one sec

graceful shore
#

i opened the folder

graceful shore
#

im literally using if(message.attachments.size >= 1) return; and it still crashes

digital ibex
#

btw, idk what ur problem is bracket, but the if (channel && message.content) is redundant since it'll always be true

#

jus inefficient to have that there

digital ibex
#

oh wait im sorry

wheat mesa
digital ibex
#

i didnt fully read it, u may need it

graceful shore
#
if(!message.content) return;
if(message.content.length  >= 1){
if (!message.channel.name.includes("_rem")){
const channel = message.member.guild.channels.cache.find(channel => channel.name === "uwulog");
if(channel){

const botlog = new Discord.MessageEmbed();
botlog.setTitle(`Log`);
botlog.setColor('#ae00ff')
botlog.addField("#"+message.channel.name + " < User ID:" + message.member.id + "> " + message.member.user.tag + ":⠀" + message.content, "⠀");

channel.send(botlog).catch(()=>{ channel.send("Could not send log message")});
}
}
}
#

even this doesnt work

digital ibex
#

whats not workin

graceful shore
#

when i post a image only

#

it still tries to log it

#

and gives a error

digital ibex
#

just

#

im pretty sure u have to add something to the value of the embed field

digital ibex
#

just google whitespace and copy it out or something

graceful shore
#

its a invisible character

digital ibex
#

ye

#

ih

#

oh

#

use the unicode

graceful shore
#

i did that

#

idk why this isnt working

digital ibex
#

well show line 898 O_O in bot.js

graceful shore
digital ibex
#

use the unicode

#

u just copied out a space

#

for no reason then

graceful shore
#

the value is a invisible character that isnt a space

digital ibex
#

try the unicode

graceful shore
#

i am

digital ibex
#

thats not a unicode

graceful shore
digital ibex
#

that is the loc which is causing the error

graceful shore
#

well no

#

this is the code that is causing the error

wheat mesa
#

@digital ibex ```js
module.exports = class RandomGenerator {
// Code stuff
constructor() {
// Does stuff
}

TestFunc() {
    return console.log("Works")
}

}

digital ibex
#

what line is that?

wheat mesa
#
const Index = require("./index.js")

const Myobj = new Index()

Myobj.TestFunc()
digital ibex
#

kk ty waffle

graceful shore
digital ibex
#

my head is hurting

#

please

#

u got ur code here

wheat mesa
#

Yet another steam scammer

digital ibex
#
// message.content = '';

message.channel.send(message.content) // Error: Cannot send empty message

if (!message.content) {
// ...
message.channel.send(message.content) // Will not send 
}
#

u understand whats goin on here

#

ur checking if message.content is actually like

#

a thing

#

AFTER you send the message

#

so you need to check before you send it

wheat mesa
#

Also why do you have that many lines in one file!

digital ibex
#

also, please please please i beg u rewrite ur bot

#

yes

wheat mesa
#

I recommend setting up command and event handlers

graceful shore
#

it was that code giving errors

#

i deleted it and tested and no errors

digital ibex
graceful shore
#

ima move the code cuz i know warning works before

digital ibex
#

moving the code isnt going to change anything

#

all you need to do is move one line

#

and error fixed

#

no error if u wanna say that

#

btw @wheat mesa

#

were u getting the errors when u first cloned

#

?

wheat mesa
#

I didn't clone, I just set up a small test project

digital ibex
#

yeah cuz im still getting the error

#

idk whats goin on

wheat mesa
#

That's the problem

digital ibex
#

it was workin before but i changed it to module.exports = class .....

wheat mesa
#

Instead of doing js module.exports = RandomGenerator do ```js
module.exports = class RandomGenerator {
// Class code here
}

digital ibex
#

yeah i done that

#

btw that doesnt change anything

#

i done it but still no worky

wheat mesa
#

Did you save it before running? Because whenever I change my test setup to this ```js
class RandomGenerator {
// Code stuff
constructor() {
// Does stuff
}

TestFunc() {
    return console.log("Works")
}

}

module.exports = RandomGenerator;

digital ibex
#

Index is just an empty obj for some reason

digital ibex
#

?

wheat mesa
#

Yeah, hold on

eternal osprey
#

hey

#

i was having a question

#

I am constantly generating a new folder in js

#

that contais a few lines

#

they all have the same name and then delete it.

#

How do i send the contents directly into an excel file?