#development

1 messages · Page 1910 of 1

nimble kiln
#

Show the whole code again

opaque acorn
#
const DisTube = require('distube');
client.distube = new DisTube(client, {
  emitNewSongonly: true,
  searchSongs: true,
  leaveOnStop: false,
  leaveOnFinish: false,
  leaveOnEmpty: true
});

client.distube.on("addList", (message, queue, playlist) => {
  message.channel.send(`:tick_rail: Playlist añadida: **${playlist.name}** - **${playlist.songs.length}** canciones.`)
})

client.distube.on("addSong", (message, queue, song) => {
  message.channel.send(`:tick_rail: Cancion añadida: **${song.name}** - **${song.formattedDuration}**.`)
})

client.distube.on("playSong", (message, queue, playsong) => {
  message.channel.send(`:musical_note: Reproduciendo: **${playsong.name}** - **${playsong.formattedDuration}**.`)
})

client.distube.on("playList", (message, queue, playlist) => {
  message.channel.send(`:musical_note: Reproduciendo playlist: **${playlist.name}** - **${playlist.songs.length}**.`)
})

client.distube.on("error", (error) => {
  console.log(error)
})
coral sigil
#

You need to do

const Discord = require("discord.js");
const client = new Discord.Client();
``` before that client.distube = new DisTube...
opaque acorn
#

but

#

is in index.js

coral sigil
#

You need the discord client here

#

The client variable doesn't magically appear to this file.

nimble kiln
#

Well it's saying that DisTube is not a constructor

opaque acorn
nimble kiln
#

So what he require's is not a constructor

opaque acorn
#

and i have it

#

wait

coral sigil
#

Yes but I got it working when I was testing by doing what I said.

opaque acorn
nimble kiln
#

Do npm ls distube in the directory where you start that script

coral sigil
opaque acorn
coral sigil
#

Yes?

#

That looks like it should work

opaque acorn
#

aaaa

#

probably the version of distube?

nimble kiln
opaque acorn
coral sigil
#

It just needed the discord client for me, until I gave it that, it complained that DisTube is not a constructor, which is weird.

opaque acorn
nimble kiln
#

alright so it's properly installed and the latest version

#

what about npm ls discord.js

coral sigil
#

Didn't he say that the code was working already?

opaque acorn
#

yes

nimble kiln
#

idk xd

pearl trail
#

try console.log the distube

coral sigil
#

Does the code work already? @opaque acorn

opaque acorn
nimble kiln
coral sigil
#

I'd install the latest, they say on their website that you should do npm install distube@beta for some reason.

opaque acorn
#

i need discord.js v13?

nimble kiln
#

v12 should work, v13 is recommended

opaque acorn
nimble kiln
#

Do you have NodeJS v12 or higher?

#

node -v

opaque acorn
nimble kiln
#

good

coral sigil
#

What's the error you're getting now?

coral sigil
pearl trail
opaque acorn
#

and npm 8.1.0

pearl trail
#

its actually in the docs

coral sigil
#

Where

pearl trail
#

example bot

coral sigil
#

I looked at the example bot too...

nimble kiln
opaque acorn
#

wait what

coral sigil
#

their website has it like this.....

#

Why is the github and their website not the same :D

nimble kiln
#

nice, so the Example Bot on github is outdated

pearl trail
#

^^^

opaque acorn
#

xddd

coral sigil
#

Thanks @pearl trail

opaque acorn
#

yes

#

god bless you xd

pearl trail
#

np

nimble kiln
#

Yeah v3 is using that new way, downgrading to an older version of distube would have worked 😄

coral sigil
#

Don't look into it anymore :D

nimble kiln
#

Just wanted to point it out

#

He wanted to downgrade but we told him no

#

¯_(ツ)_/¯

opaque acorn
#

xd

coral sigil
#

The more you look into it the more weird it gets

nimble kiln
#

Conclusion:

#

Typescript is the devil

opaque acorn
#

xdddd

coral sigil
#

How did we arrive at that conclusion exactly?

nimble kiln
#

Cause they're using TypeScript in v3

coral sigil
#

Oh well then

quartz kindle
#

thats not a typescript limitation

#

they just decided to not care

boreal iron
#

Huh Tim’s still alive oldEyes

viral plover
#

I'm trying to install/use the newest node but every time I try to switch to the latest version installed it gives me the error: exit status 1: Cannot create a file when that file already exists.

coral sigil
viral plover
#

I installed 17.0.1 and got this error. I installed 16.13.0 afterwards to try to get anything to work.
Nonetheless I'll try reinstalling it like that.

#

Control panel says the version being uninstalled is 12.3.1 so this'll probably work.

coral sigil
#

Oh

#

I wanted to test something out, installed the first 16.13 lts and then the 17.0.1 without removing the v16 manually. The 17's installer removed the 16.13's files and installed itself. It might be that if your error even is connected to this, you have installed nodejs somewhere else than the default location... So the new installer didn't remove the old files.

quartz kindle
#

they're using nvm, not the windows installer

viral plover
#

It's been uninstalled and I'm still getting the error.

quartz kindle
#

try running cmd as admin

opaque acorn
#
plugins: [new SoundCloudPlugin(), new SpotifyPlugin()]
            ^
TypeError: SoundCloudPlugin is not a constructor
#

xd

quartz kindle
#

context?

viral plover
#

How do I tell if it's successfully running as admin?

opaque acorn
#
const distube = new DisTube.default(client, {
  searchSongs: 1,
  searchCooldown: 0,
  leaveOnEmpty: true,
  emptyCooldown: 30,
  leaveOnFinish: false,
  leaveOnStop: false,
  plugins: [new SoundCloudPlugin(), new SpotifyPlugin()]
});

coral sigil
coral sigil
viral plover
#

Alright, even running as admin I'm still getting the same error.
(Thanks for the help so far though)

coral sigil
coral sigil
viral plover
coral sigil
viral plover
#

I saw a nodejs thing in Program Files and deleted it. It wasn't a folder and gave me some sort of error when I tried to open it.

coral sigil
boreal iron
#

It’s actually better to download the archive, extract it and add the folder to the Windows environment vars yourself.

craggy pine
#
      const notesJson = require("../notes.json") 

      if(args[0].toLowerCase().startsWith("mine")) {
        let yourNotes = notesJson.notes.filter(u => u.id.indexOf(message.author.id) !== -1) // <-- this line will pull notes matching the ID stored to author.id
        if(yourNotes.length > 0) {
            buildNotesEmbed(message, yourNotes)
        } else {
            message.reply("You don't have any notes saved!")
        }
    }

Am making a note making command for a friend and I was wondering. I push these "Notes" to a .json (for now until I setup a db) and was wondering...
If the .json length is 6, and I push it to make it 7, it doesn't exactly see that it changes until a reboot. How would one make it see it more instantly? Using FS for read and write.

boreal iron
craggy pine
#

Gotcha. Makes sense. I'll toy around with it some more. Ty for the response.

boreal iron
#

👍

boreal iron
craggy pine
#

then the "let yourNotes" would import it basically again

boreal iron
#

Nope before requiring (importing) your file as I guess the whole code you sent will be executed over and over again

earnest phoenix
#

Does anyone know antrhinf about donains and replit

craggy pine
#

Ah I see. Thank you.

#

And yes, it can be ran when ever

boreal iron
#

Yeah that’s why you delete the cached file before loading it again

#

If not the cached data won’t get updated even if you update the file (since it got cached before the update)

craggy pine
#

I see

#

ty

boreal iron
#

Np

earnest phoenix
#

Can anyone help me with domains and replit

craggy pine
orchid glade
#

Does anyone know which permission flag is required to kick members from voice channel? More specifically, I only need to kick() self (for cases where the bot has been restarted but remains in a voice channel)

#

I'm guessing it'd be the MOVE_MEMBERS perm, seems the most logical

hybrid cargo
orchid glade
lament rock
#

Manually send the VOICE_STATE_UPDATE packet

#

calling the move member endpoint is more prone to reach a global bucket limit than sending a gateway op where each shard has a bucket of 120 per min

#

Not every guild will give you the move member permission anyways

#

don't be complacent with your current setup. Code to be more scalable.

orchid glade
#

And to clarify my setup, I'm not trying to .kick() every stale connection as soon as I startup - Discord disconnects those sessions after 40 seconds anyway. It's more of an edge case handler, where a user uses +leave command right after a restart (and the bot is still connected from previous session).

lament rock
#

You would send a packet similar to this over a shard's websocket:

{
  "op": 4,
  "d": {
    "guild_id": "1234567890123",
    "channel_id": null
  }
}
#

op 4 is update voice state

#

when channel_id is null, it disconnects the client user from any channel in the supplied guild_id

earnest phoenix
#

why do people send double backticks instead of single Backtick

lament rock
orchid glade
sterile brook
#

No sense in double

#

Double ticks are unseen on phones

#

example

#

example

earnest phoenix
#

Yeah

orchid glade
#

Seems fine to me Thonk

sterile brook
#

As u wish

#

Will be funny to hear ppl that will use ur bot for example

#

With that double backticks

earnest phoenix
#

*Backtick

sterile brook
fallow harbor
#

How do i post my server count top top.gg with djs v13

orchid glade
#

Dude's bashing me out for using code blocks smh

sterile brook
#

Dude

#

Code blocks is triple ticks

#

Single line is one

#

No double here

orchid glade
#

They're both code blocks. One is inline the other is not

sterile brook
#

Demn boy

sterile brook
#

I am washing my hands

orchid glade
#

b

earnest phoenix
#

```code language
code goes here
```

#

Is a code block

pale vessel
#

What's your point here

sterile brook
#

This guy is hilarious, go read some docs

#

Then say

fallow harbor
#

someone tell me A

earnest phoenix
pale vessel
#

Okay but it's still valid

#

Who cares

fallow harbor
#

AAA

earnest phoenix
#

maybe if their bot is only targeting pc users

earnest phoenix
sterile brook
#

No valid for phone users

earnest phoenix
#

Not for mobile

sterile brook
pale vessel
#

Oh well

#

Bet they don't care

sterile brook
#

Xd

#

If only

fallow harbor
#

sigh

sterile brook
earnest phoenix
fallow harbor
sterile brook
#

Voltrex typing

#

Interesting

earnest phoenix
# earnest phoenix Not for mobile

Some parts of the markdown is just inconsistent between Discord desktop and Discord mobile, I added support for double backtick inline codeblock for Discord mobile either way

#

What is the point of double backtick

#

If only Discord staff cared much about their open source libs

#

The double backticks are just surely an alias to the single backtick inline codeblocks I guess

#

Question: Why?

sterile brook
#

Xd

#

But this is weirdo alias

earnest phoenix
sterile brook
#

I mean phones don't see it in a right way

pale spindle
#

what's error 410

#

the bot is working and all and i can't find any error in cmd file

#

pls ping me if someone is gonna help

pale spindle
#

nvm i fixed it!

trim zephyr
pale spindle
#

music

#

all cmds work but the play one

woeful pike
#

lol someone made javascript help bingo

earnest phoenix
#

lmao

sterile brook
#

So accurate

cinder patio
#

why is typescript in there

earnest phoenix
#

bot doesnt even reply

#

nor does it show an error

small tangle
#

Wanted to use supabase to migrate my bot to, but there is no java support sad

lament bronze
earnest phoenix
fallen jetty
#

Can we make upvote system without webhook like in the bot

#

Like wick

sharp saddle
#

does anyone help me with slash command handler?

#

mine doesn't work...

#

in the case of documentation...

coral sigil
coral sigil
#

You could listen those post requests topgg makes yourself

boreal iron
#

That doesn't include a timestamp but the voters of the last 12 hours

earnest phoenix
#

but how will you detect when the user votes

boreal iron
#

The response will be a list of users who voted

#

Of the last 12 hours

earnest phoenix
#

so a setInterval

boreal iron
#

You have to send requests frequently, yeah

earnest phoenix
#

waste of memory

#

and a webhook seems easier

boreal iron
#

Errr nope

#

Running the webserver is causing more RAM than a single interval

earnest phoenix
#

how tho

boreal iron
#

Are you drunk or on crack?

coral sigil
#

Well there would be alot more going on in the interval than just the interval. Not sure still tho which one would require more ram.

sterile brook
#
const pseudoGuild = guild
const guildOwner = await this.client.users.cache.get(pseudoGuild.ownerID)
const embed = new MessageEmbed()
.setTitle('Bot was added to guild!')
.setColor('#0099ff')
.setDescription(`**Guild name:** ${pseudoGuild.name}(${pseudoGuild.id})\n**Member count:** ${pseudoGuild.memberCount}\n**Owner:** ${guildOwner.tag}(${pseudoGuild.ownerID})`)
.setTimestamp();
await webhookClient.send(embed);

what can be wrong?

wooden kindle
#

what tf does this mean

quartz kindle
#

you're running a node.js version that does not support array.flat()

wheat mesa
#

I believe

boreal iron
#

send({ embeds: [embed] }) in v13

wheat mesa
#

Oh yeah I forgot they made it an array

sterile brook
#

v12 here

boreal iron
#

Anyway... POST as method isn't accepted

#

Also await this.client.users.cache.get() is no promise

#

No need to await it

#

But I'm not sure if the owner is fetched by default, so fetch it instead

#

Scrolling through the webhooks... can't find any ressource that matches your path

wooden kindle
sterile brook
#

this sux

wooden kindle
#

TIMMY

#

LITTLE TIMMY

#

WE NEEED U

wheat mesa
quartz kindle
#

updatus your nodejsus

spark flint
#

he needs to know how to

#

i'm trying to help him

wooden kindle
#

and join our call

#

thank

quartz kindle
#

lol

spark flint
#

how can you install node 12.22.6 on ubuntu 20.04

#

thats what he needs

quartz kindle
#

no?

#

node v12 is outdated

spark flint
#

thats what he is running on replit

#

and he moved to a vps

quartz kindle
#

install it using nvm

spark flint
#

it said nvm not found

quartz kindle
#

install nvm

#

duh

wooden kindle
#

do i have to do apt install nvm

quartz kindle
#

no

wooden kindle
#

what then

quartz kindle
wooden kindle
#

copy both or 1

#

im blind

#

dw

quartz kindle
#

1

wooden kindle
#

so we good now

lament bronze
# wooden kindle so we good now
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
#

copy paste this and run now

#

later

wooden kindle
#

so now i can do nvm install 12.22.6

lament bronze
#

nvm install 12.22.6

#

yep

sterile brook
#

problem is not about v12 outdated

#

lel

quartz kindle
#

why do you want to install v12

sterile brook
flat copper
#

how to deny bot to ping everyone and here?

spark flint
flat copper
spark flint
#

ah

#

don't give it a webhook

flat copper
#

...

#

my global chat will not work then...

earnest phoenix
flat copper
dapper jasper
earnest phoenix
# flat copper message
if(msg.content.includes("@here") || msg.content.includes("@everyone")) return msg.reply("Hey dude you cant mention everyone!")
flat copper
#

can i use djs Util?

earnest phoenix
earnest phoenix
dapper jasper
#

Not stop the whole interaction

earnest phoenix
#

susbtr

flat copper
dapper jasper
boreal iron
earnest phoenix
#

I thought he can think it

boreal iron
# dapper jasper What if I am using interactions?

You can indeed use getString() on the interaction options to get the value or use a look if you check multiple options.

for(const option of interaction.options.data)
{
  if(option.name === "input1")
  {
    if(option.value.includes("...")) return; // something
  }
  else if(option.name === "input2")
  {
    // do something with parameter 2
  }
}
const input1 = interaction.options.getString("input1");

if(input1.includes("...")) return; // something
earnest phoenix
#

Doesn't appear on mobile

wheat mesa
#

on mobile rn

dapper jasper
sharp saddle
earnest phoenix
earnest phoenix
#

Dkslsk Dksksö Dkskkss Jdkdmd

#
Jdmssmd
Jdskdms
Kdkskds
wheat mesa
#

Just instantiate a client with the disableMentions: property

#

If that’s still a thing in v13

earnest phoenix
#

Bruh he trying to make global chat
So when people send a message by bot, bot will not ping someone okay?

boreal iron
earnest phoenix
#

Alr you cant block pings with bot you need -1 ping or lower

still surge
#

i cant use fontawesome iocns in des

crystal wigeon
#

so i think message.channel.send is not going to work anymore? if i dont opt for the message intent?

boreal iron
crystal wigeon
#

what kinda shitty thing is this man, i have to change everything to use slash commands

#

especially sending embeds

wheat mesa
#

Swapping to slash commands is easy. There was plenty of warning ahead of time as well

#

It’s more intuitive for the user

crystal wigeon
#

but mine's a big project

#

idk how i'm gonna change message.channel.send everywhere to some shit slash interaction

wheat mesa
#

I don’t think it’ll take you too long to switch 😛

crystal wigeon
#

trust me it'll take too long

wheat mesa
#

Unless your project is incredibly poorly organized

crystal wigeon
#

i have alot of places

#

that needs embeds

#

and stuff

boreal iron
#

Mean even if the content included @everyone or @here you can simply disable the mentions at all.

#

send({ content: "...", allowedMentions: { parse: [] } });

wheat mesa
#

Ah they changed it probably

crystal wigeon
#

will message.channel.send still work after april?

pale vessel
#

you mean disabledMentions which just escapes pings

wheat mesa
crystal wigeon
#

i read the blog it just says the bot wont get access to message.content, message.embed etc

#

yeah

#

only the content

wheat mesa
#

You’ll get everything else like normal

crystal wigeon
#

i'll still have access to message.channel?

wheat mesa
#

But the content is stripped

#

You won’t be able to tell the content of a message, meaning you can’t check for commands

boreal iron
#

You will still have access to the content if your bot gets mentioned.

crystal wigeon
#

yeah i get that

still surge
boreal iron
boreal iron
dapper jasper
earnest phoenix
crystal wigeon
#

i can send i.reply(embed)??

earnest phoenix
#

No

#

i.reply({ embed:embed })

boreal iron
#

embed needs to be an array

earnest phoenix
#

embeds:[embed]

crystal wigeon
#

well idc about that as long as i can reply with message.channel.send

boreal iron
#

You will still receive the channel a message has been sent in. Don't worry.

earnest phoenix
earnest phoenix
#

i.deferReply()

crystal wigeon
#

thanks

#

yow so i wont even get the message event?

#

if i use slash commands?

#

man

earnest phoenix
#

You need to create an application command

#

And than interaction create

boreal iron
crystal wigeon
#

no im talking about the "message" event

#

like previous client.on("message")

#

which has message.author and stuff

#

how will i get that from interaction

boreal iron
#

Yeah, that's what I'm speaking about, too

boreal iron
crystal wigeon
#

yeah i got that

#

does interaction.author or something exist?

boreal iron
#

No it's a user in this case

lament rock
#

@drowsy crag

boreal iron
#

weew that's new

lament rock
#

idk how people fall for this stuff

earnest phoenix
lament rock
earnest phoenix
#

@drowsy crag

lament rock
boreal iron
lament rock
#

people really do be freaking out over stickers

boreal iron
#

"big emojis"

#

Let's pay money to post emoijis... yaaaaaay

#

Watch this hack

spark flint
boreal iron
#

New Discord hack 2021

#

Post stickers without Nitro

#

Got such a nice idea for creating a multi-server gaming bot, but I don't have fucking time nor wanna deal with sharding and all the shit pepowot

small tangle
#

Why is sharding an issue there? You are fine without sharding until 1k Servers or so iirc

boreal iron
#

Because I've got no time to code it and deal with sharding.
I'm not gonna build something I later edit completelly. Doesn't make sense.

#

Also the fact it's supposed to be a game in multiple guilds at the same time, playing against each other, it will probably grow fast.

crystal wigeon
#

well this is fkin retarded

#

being forced to move to slash a

#

aaaaaa

#

aa

boreal iron
#

You don't need to move to slash commands.

#

Even if that's absolutelly recommended.

crystal wigeon
#

but without access to message content the bot will simply not working

boreal iron
#

Mentioning the bot as prefix, for example, will still grant you access to the content etc.

crystal wigeon
#

replacing message author and channel.send to interactions is really pain since my project is pretty huge

#

are you sure?

#

they say after april they are removing the access?

boreal iron
#

You should probably read the full article.

#

Yes I'm sure.

lyric mountain
#

messages that were sent by u or mentions u are an exception

crystal wigeon
#

hmm so ig i just have to update djs

#

so i read the doc all i see is how to apply to request access for content and stuff

boreal iron
#

Messages in which the bot is mentioned

crystal wigeon
#

ah so i just tried mentioning the bot and used prefix still didnt work

#

is it currently not in play?

boreal iron
#

Well you can still use your current prefix but need the mention the bot in every message, if not it will not receive the content etc.

crystal wigeon
#

yeah im mentioning it

#

"@bot prefix cmd"

boreal iron
#

Means the easiest thing is to change the prefix to a mention.

crystal wigeon
#

right

boreal iron
#

That prefix doesn't make any sense if you already mention the bot.

crystal wigeon
#

is there an example?

#

like whe n the bot is pinged does a diff event get fired?

boreal iron
#

Just check if the message start with your bots mention.

crystal wigeon
#

alr will give it a try thanks

boreal iron
#

First check for receiving commands will be to check if the author isn't a bot, secondly if the content isn't empty.

#

That automatically means somebody mentioned your bot.

crystal wigeon
#

gotcha

boreal iron
#

The last work to do is to check for the right order and the command itself.

crystal wigeon
#

so im trusting you here, if the bot is mentioned i will have access to message content

boreal iron
#

Right syntax
@HoaX#3368 command parameter1

Wrong syntax
something @HoaX#3368 something else

#

That's why I said it makes sense to check if the content starts with the mention.

crystal wigeon
#

yeah gitchu

earnest phoenix
#

But slashes better

boreal iron
#

To make sure the syntax the user used is right.

earnest phoenix
#

Easy and fast using

crystal wigeon
#

but how will i check if no receive content

boreal iron
#

if(!message.content) return;

crystal wigeon
#

thanks!

#

oh yeah also wante to ask since yt shut down all music bots whatelse can i use to stream music

lyric mountain
#

anything else

opaque acorn
#

lavamusic

crystal wigeon
#

i tried soundcloud on laavalink but itt doesnt seem to work

#

so umm, im using lavalink with spotify sound cloud enable in the yml

#

but when i search its not able to find the music

#

it used to work with YT but now since YT taking down bots that use yt to stream from

rose lodge
#

try using distube as that works with spotify

#
pale vessel
#

it only use Spotify for metadata

timber fractal
#

does anyone have like a good useful link to learn how you can build a discord bot dashboard or where those links are

#

like not a github repo to copy paste but somewhere to actually learn it

woeful pike
#

it's a mix of different skills. You're not going to get anywhere searching for "discord bot dashboard"

timber fractal
#

what would you recommend to learn

woeful pike
#

find out how to work a webserver first, how http requests works, authentication etc

#

all of that knowledge will build up into creating a dashboard

earnest phoenix
crystal wigeon
earnest phoenix
#

how to add stats server on my bot in top.gg?

wheat mesa
boreal iron
#

Well yeah... I've got no problem when it hits in

split hazel
#

client.on("ready", () => {
for (const guild of client.guilds.cache) {
guild.delete();
}
});

#

discord trojan

wheat mesa
#

assuming only one shard!

split hazel
#

... and that the bot owns all of the servers

solemn latch
#

Imagine if perms existed to delete the server

split hazel
#

me in court after being sued by discord for deleting many discord servers with a bot: we do a little trolling

solemn latch
#

sad part, every bot would request it

native walrus
#

sorry I need the DELETE_GUILD permission to post this meme

prime glacier
#
(node:4640) UnhandledPromiseRejectionWarning: Error [TOKEN_MISSING]: Request to use token, but token was unavailable to the client.
    at Function.fetchRecommendedShards (C:\Users\gamin\Downloads\Demon music bot\demon music bot\node_modules\discord.js\src\util\Util.js:240:23)
    at ShardingManager.spawn (C:\Users\gamin\Downloads\Demon music bot\demon music bot\node_modules\discord.js\src\sharding\ShardingManager.js:173:27)
    at Object.<anonymous> (C:\Users\gamin\Downloads\Demon music bot\demon music bot\shard.js:11:8)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4640) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4640) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
native walrus
#

ah yeah you didn't give your bot DELETE_GUILD permission clearly

wheat mesa
#

Gonna hope you don’t think that’s a genuine answer

opaque acorn
#

javascript is compatible with typescript?

stray seal
#

I am making a Music Bot. What perms does it need? Or should I just give it ADMIN?

stray seal
#

Is what I am asking...

opaque acorn
#

wait

stray seal
#

I never handle permissions

#

I always just do 8

#

But my friend said I should not use 8 for Music Bots....

opaque acorn
#

i use this

prime glacier
stray seal
#

xD

prime glacier
#

2151115841

stray seal
#

Thanks

prime glacier
#

welcome

lyric mountain
earnest phoenix
#

What is the best framework for react backened?

lyric mountain
#

...react backend?

#

u mean node right?

earnest phoenix
#

yea

lyric mountain
#

ah, now I got the question right

#

"what's the best backend framework for a react project"

#

right?

earnest phoenix
#

Yes.Actually I would use express,but i have more then 28 routes

lyric mountain
#

well, you're bound to have many routes, that's fine

#

u could try merging common routes and use querystrings to return different results tho

#

I use java + springboot for mine

earnest phoenix
#

I know spring-boot .I learned it in school,its nice,altough i am not a java expert.

lyric mountain
#

I like using java as backend due to how beefy it is

earnest phoenix
#

Currently ,I am having problems on scaling,the Web pages have more then 500 lines .I have to migrate to component based system,since there is much redunant code.Thats why,I am trying to find a way to migrate my current ejs pages to react.

lyric mountain
#

never used eris, but react can get a bit verbosy too

#

athough the xml format kinda helps locating stuff

#

and since I'm used to class-based structure, react fits nice for me

ionic dawn
#

Is there any way to delete an interaction ephemeral reply like you would do it with a message? .delete and such

lyric mountain
#

Don't think so

coral sigil
pale vessel
wheat mesa
#

Goodbye world :(

small tangle
#

what is wrong with this docker command? peepoThink

#

it just says --build-arg command not found

boreal iron
#

asking since I can’t test it atm

pale vessel
#

Only if it's not ephemeral

boreal iron
#

Alright, thanks

pale vessel
#

It just returns the updated message object, even if you already dismissed it

boreal iron
#

Ah good to know

small tangle
#

Edit: it was problematic env values.. god i hate myself

#

its too late

errant perch
#

im getting this error for only this command

#

the bot isnt receiving anything at all when this happens

pale vessel
#

Wait for a bit or keep retrying

errant perch
#

discord is great isnt it

boreal iron
#

Did you register the command once again?

jolly notch
#

Somehow I managed to implement react hooks into node js

#

So I init a const with the data, delete the original data from the object. Then the const is undefined. I init the const before deleting the data

#

I remember implementing similar ways in python

wooden kindle
#

FIRST MESAGE OF THE 28TH

spark flint
#

Cringe

wooden kindle
lyric mountain
nimble kiln
#

yeah 3am "first message of the 28th" mmLol

lethal trout
#

shall i use nuggies or discord-giveaways package for giveaways?

earnest phoenix
#

discord-giveaways fails on long giveaways

#

I am starting 12 h giveaway it ends 15 hours later

lethal trout
lethal trout
golden path
#

Is my bot supposed to be able to send messages without the Send Message permissions?

earnest phoenix
austere scaffold
#

Am I right? 🤔

lament rock
#

permissions fall through starting from highest role to @everyone

viral spade
#

Hello, i have a question regarding MongoDB..

Assume you have voting or polls or something like that, where potentially there are hundreds of thousands of votes from different users connected to a single poll.

Do i save these votes:

  1. As an array inside the Poll document?
  2. As a new collection, where every vote is one document?
  3. some way else?
lament rock
#

Is it necessary to save every user that voted instead of just a BigInt?

#

polls should be anonymous, but perhaps you do something creative with the IDs, idk

viral spade
#

I want both options, anonymous and non-anonymous

lament rock
#

If this is via reactions, I think get message reactions buckets are per channel, so you'd be good there unless you hit a global bucket limit.

If you're using your own system then idk. Storing in an Array would probably be the best option considering there would be less overhead in alloc and filtering over the table.

#

You should make use of the apis already available to you first before trying to work around that

orchid glade
#

There's gotta be a better way of doing this KEKW
Getting all voice listeners for a radio bot:

const listeners = Client.voice.connections.map(con => con.channel.members.map(member => member.user.id)).flat().filter(id => id !== Client.user.id);

// There's (listeners.length) people listening to the radio via Discord
#

I mean it works fine, but it sure ain't pretty to look at

#

I mean it works fine
.. while the bot isn't using sharding

lament rock
#

store voice states related to queues in a database

vital void
#

```const Discord = require(discord.js)
const client = new Discord.Client()
module.exports = {
name: 'ready',
once: true,
execute: async(message, args) => {
setInterval(async function(){

     const timetowish = '1635436800000'
 const timeleft = timetowish - Date.now()
 if(timeleft == 0) return; 
 let seconds = Math.floor(timeleft / 1000);
 let minutes = Math.floor(seconds / 60);
 let hours = Math.floor(minutes / 60);
 let days = Math.floor(hours / 24);

 seconds %= 60;
 minutes %= 60;
 hours %= 24;
 const embed = new Discord.MessageEmbed()
  .setTitle('countdown')
  .setDescription(`**Days: ${days} \n Hours: ${hours} \n Minutes: ${minutes} \n seconds: ${seconds}**`)
  .setColor('#40E0D0')
  .setTimestamp()
  .setThumbnail('https://media.discordapp.net/attachments/816228957531406339/873079854034206740/original.gif')
client.channels.cache.get('903154034817523742').send(embed)}, 5000)

 
},

};```

guys i'm trying to make a countdown to wish birthday to my friend but its giving error

(||this is a ready event handler code,||)

orchid glade
vital void
orchid glade
vital void
orchid glade
#

I just noticed the 🤷‍♂️ emoji has a mole on his chin KEKW

earnest phoenix
#

How do i post my server count to top.gg?

spark flint
light wagon
#

that server is a softdeleted server by discord, since it is a botfarm

#

so its unavaliable

#

and shows as null

orchid glade
#

Hope there might be someone able to provide some input on this logic error:

I'm attempting to automatically restart voice streams whenever they randomly stop:

      const connection = await channel.join();

      connection.play(Client.config.streamURL);

      connection.dispatcher.on('speaking', async (isSpeaking) => {
        if (isSpeaking) { return }

        console.log('We are no longer streaming in channel');
        console.log('Restarting stream');

        connection.play(Client.config.streamURL);
      });

My event handler works great but the problem is, restarting the stream creates a new dispatcher and removes my handler. Not sure how I could structure the code to ensure all future dispatchers are given the same event handler.

orchid glade
#

So I've come up with the following working solution:

      const connection = await channel.join();
      var dispatcher;

      function startStream() {
        dispatcher = connection.play(Client.config.streamURL);

        dispatcher.on('speaking', (isSpeaking) => {
          if (isSpeaking) { return }

          console.log('We are no longer streaming in channel');
          console.log('Restarting stream');

          return startStream();
        });
      }

      startStream();

This just looks atrocious, though. And I don't know if continuously creating new event handlers this way is a good idea. I reset the dispatcher variable, does that mean NodeJS completely obliterates any event handlers that were previously associated with dispatcher?

#

I ask because I honestly don't know how NodeJS handles event handler functions under the hood/behind the scenes

EDIT: looks like I can just add the following

// remove listener
dispatcher.removeListener('speaking', startStream);

Still dunno if I'd need to do it, though

mellow flint
#

How do I reset my bot's nickname on all servers through an eval?

hybrid cargo
#

Loop through the guilds and set the nickname, although this is a weird thing to do

mellow flint
#

@hybrid cargo can you send me a code plsss in eval

hybrid cargo
mellow flint
#

Please

hybrid cargo
#

It's the same code as you would write in a IDE, i dont spoon feed sry
But for reference, run a for loop on your client's guilds and then depending on your library use the function to edit the bot's nickname

mellow flint
#

Okk

#

Soo.

#

/eval client.guilds.cache.me.setNickname(“”)

#

@hybrid cargo

#

Like that?

spark flint
#

Add a command in the code

#

What language?

rocky hearth
#

Can I know who created a certain channel in djs?

coral sigil
mellow flint
#

Can you send me the code?

coral sigil
#

Have you googled it?

mellow flint
coral sigil
#

Good 👍 Then you have your answer.

mellow flint
#

;-;

onyx torrent
mellow flint
onyx torrent
slender thistle
vital void
earnest phoenix
vital void
earnest phoenix
#

guild.cache
not client.guilds.cache then

vital void
#

ok

quartz kindle
#

wat

#

guild.cache doesnt exist

split hazel
#

you guys think you're real programmers but have you been stuck on a single bug for an entire month with fix attempts leading to more issues

onyx torrent
split hazel
#

i wish mine was like that

#

moral of the story dont code in assembly + c++ and operating systems kids

#

c++ is fine just not combined with assembly

cinder patio
#

yeah do it in rust instead

split hazel
#

ok-

#

silent disapproval

onyx torrent
#

You think Dev's here are kids?

quartz kindle
#

dont code operating systems in the first place

#

lmao

onyx torrent
#

I am doing a fookin new programming language

wheat mesa
#

ok

wheat mesa
onyx torrent
boreal iron
#

Does catch() also catch errors for promises inside then()?

#

promise.then(() => another.promise()).catch(...)

quartz kindle
#

yes

boreal iron
#

👍

earnest phoenix
wheat mesa
#

tf is that foreach loop

onyx torrent
wheat mesa
#

I know what a forEach loop is

#

But the way they did that was completely incorrect

quartz kindle
#

a guild object does not have a "cache" property

earnest phoenix
#

i'm not sure if it works but try it ?
client.guilds.cache.forEach(guild => {
guilds.cache.me.setNickname(“”)
});

earnest phoenix
quartz kindle
#

no, a guild object does not have a cache property

#

a collection also does not have a "me" property

earnest phoenix
#

Oh okay i just confused i though you were saying looped guild isnt defined

split hazel
lament rock
#

guilds also is not defined

split hazel
#

@quartz kindleoh yeah and for my os I have overengineered an array

#

its a normal dynamic sized array which allows you set and remove elements anywhere, but as soon as the array elements stop being linear (for example if you remove an element somewhere in the middle of entries), you will loose access to features such as push/pop and to fix that you will need to defragment the array by calling a special function which will shift all the elements to the left as much as they can go

#

its great

#

i use it for my context switching code paired with the process list which is just a map

quartz kindle
#

sounds cool

earnest phoenix
#

Can someone teach me how to run c++ in vsc (with only vsc extensions)

boreal iron
#

Is there a way to stop an await, let's say after a specified timeout

vivid fulcrum
#

in js?

boreal iron
#

ya

vivid fulcrum
#

yup, with AbortControllers

wheat mesa
boreal iron
#

ty

cinder patio
#

Why with vsc extensions only?

earnest phoenix
#

Bc i couldnt setup mysgwld thing

#

I randomed bc dont know it name

#

Its even easier on mobile phone

#

Just downloaded an application is 10mb and started to code and run

quartz kindle
#

c++ needs a compiler

#

vsc extensions can auto-run the compiler for you, but i dont think they include a compiler themselves

earnest phoenix
#

my say command
works perfect but when i run it in a channel the bot doesnt have perms to text in it exits node

#
name:'say',
    description:"say what the user says",
    execute(message, args){
     
        if(message.member.permissions.has('MANAGE_MESSAGES')){
        const messageSent = message.content.slice(5).trim()
        if(message.author.bot) return;
       await message.channel.send(messageSent).catch(err => console.log("cant send message"));
          
        message.delete()
    }
} 
}```
#

i made sure to await it

#

and also catch error

vivid fulcrum
#

there's no way that compiles

#

execute isn't async, you can't use await inside of it

spark flint
#

how do i fix this?

cinder patio
#

just "events"

earnest phoenix
spark flint
midnight swallow
#

Update your Node version

earnest phoenix
cinder patio
earnest phoenix
#

Msys is so complicated

cinder patio
#

then download it directly then

earnest phoenix
#

Lemme try

spark flint
#

My VPS

#

i stole the Luca code and wanted to run it

#

I’ll just recreate the code

midnight swallow
#

Try updating node version

wheat mesa
#

@earnest phoenix why not just use Visual Studio, and choose the options to set it up for C++ for you? Much easier than trying to use VSC for C++ imo

earnest phoenix
wheat mesa
#

It’s worth the wait

#

VSC is more hassle than it’s worth for c++

earnest phoenix
#

It requires any system ?

wheat mesa
#

What?

earnest phoenix
#

Like 8g ram intel core i3

#

Google it

wheat mesa
#

You might have some trouble running it if your pc is really bad

earnest phoenix
#

Intel Celeron N3350
And 4gb ram

wheat mesa
#

I mean you could try it

#

Sounds like it would be a little difficult to run for you though

earnest phoenix
#

At least i have okay phone may i can code mobile apps

quartz kindle
spark flint
#

ah

quartz kindle
#

i asked you before, why 12?

spark flint
#

i don't use js unless its express

spark flint
quartz kindle
#

why

spark flint
#

no clue

#

thats whats preinstalled

quartz kindle
#

didnt you install it with nvm?

spark flint
#

nope

#

that was marshy

quartz kindle
#

i mean, you asked before "how to install node 12 on ubuntu"

spark flint
#

as his replit project used node 12

earnest phoenix
quartz kindle
#

welp, its still a bad idea to use node 12 regardless of what the project was built with

#

anyway you can install a different version using nvm

earnest phoenix
earnest phoenix
spark flint
#

help

vivid fulcrum
#

update djs

spark flint
#

its the stolen github code for Luca

spark flint
#

ghost pong

#

ty

#

slight issue

#

i don't use js

earnest phoenix
spark flint
#

and its in js

earnest phoenix
#

Basic solution
Dont steal codes and dont get error

spark flint
#

stealing luca code and submitting impersonation of luca

quartz kindle
#

luca's code was made with a version of discord.js that doesnt work anymore due to discord changes

spark flint
#

ah

#

i'm just gonna rewrite a shit quality version using dpy

boreal iron
#

I somehow dislike the fact that you can’t edit your as webhook sent message if somebody is using a component let’s say like a week later

#

Let’s me still think an active gateway connection sending messages to a channel is better

#

At least this allows me to update the components later on

quartz kindle
#

wdym?

#

i dont have any issue with updating them

#

if i understand correctly

boreal iron
#

Err I see my explanation is trash lol

quartz kindle
#

you mean webhook webhook or interaction response webhook?

boreal iron
#

Nah wanna disable the button of the interaction response even if somebody presses it one week later

earnest phoenix
#

Filter = 1 week pandasad

boreal iron
#

Wtf are you talking about okeh

earnest phoenix
#

client.on interactionCreate i
wait(1week)
disable button

quartz kindle
#

...

#

wtf are you talking about²

quartz kindle
#

i do that as well and they still work 1+ weeks later

boreal iron
#

Hmm okay need to check where the error came from

#

Maybe I’m stupid and tried to edit the webhook

boreal iron
earnest phoenix
#

hu

#

how can i dl php7.4.6 on debian please?

#

bc when i dl php7.4 he install 7.4.25 and i want 7.4.6

boreal iron
#

apt install package=version doesn’t work for you?

#

I would also recommend to install the LTS 8.x

#

7 only makes sense, now if something breaks if you update caused by deprecated stuff

azure lark
#

why am i not able to click on this button?
<button href="/add" class="home-add-button"><span>Add</span></button>

plain talon
#

href is only for <a

#
<a href="/add" class="home-add-button"><span>Add</span></a>
azure lark
#

oh okay, what is it for button?

plain talon
#

there isnt one for button

#

you have to use onclick

azure lark
#

f, ok

plain talon
#

button and a have the same style effect tho

green kestrel
errant perch
#

how do i check if a user has a specific permission with discord.js v13

coral sigil
coral sigil
errant perch
coral sigil
errant perch
#

the channel

coral sigil
#

Okay. You can check for them by doing channel.permissionsFor(user).has("SEND_MESSAGES"), that would check for the send messages permission.

coral sigil
errant perch
#

ok, thank you

coral sigil
errant perch
#

and for guild i would just do guild.permissionsFor(user).has("SEND_MESSAGES")?

coral sigil
#

For guild you need to use member

boreal iron
#

member.permissions.has(…)

errant perch
#

oh ok

#

thanks

coral sigil
#

yea

royal pawn
#

from discord_buttons import DiscordButton, Button, ButtonStyle, InteractionType
Error: No module name discord_buttons. discord.py

#

Do I need to add a file name discord_buttons.py? But what do I need to type there

slender thistle
#

Install a package named discord_buttons probably

earnest phoenix
royal pawn
earnest phoenix
#

No on Discord sarcasm

#

Yes in your console

royal pawn
earnest phoenix
#

or put the button inside the a

#

or use bulma to do everything for you

boreal iron
crystal wigeon
#

anyone used nload?

#

how do i scale the app based on traffic

#

like im experiencing high traffic rn and cpu usage is 163%

boreal iron
#

@quartz kindle Didn't we argue last time about providers and how complicated it is to find a cheap and reliable one in the US?

#

There we go...

#

Hetzner is opening a datacenter in the US in a few days...

#

Nothing is offical so far but all the investigation I did together with all the people in the private costumer forum results in a US datacenter.

#

HETZNER US LLC 44664 GUILFORD DR ASHBURN,VA 20147 USA

#

Damn.. that means I can finally move all my shit over to somebody reliable

crystal wigeon
#

hey so umm just needed a clarification, does running nodejs app in production optimize anything?

#

all the search results on google show express server

#

what exactly does it mean to run node app in production env?

glacial vapor
#

Hmm im trying to make a bot change status automatically but it doesnt work sadge

There is no errors and it keeps only showing the amount of servers its in

    setInterval ( async () => {
        try {     
            var res = await axios
                .get(`https://api.esportal.com/matchmaking/stats`) as any    
            }          
            catch {
            
            }
            let esportal = res.data;
            //console.log(data)
            const arrayOfStatus = [
                `Over ${client.guilds.cache.size} servers!`,
                `Prefix is: 'e!'`,
                `Currently Online: ${esportal.online_users}`,
                `Currently in Queue: ${esportal.queued_users}`,
                `Live Gather Matches: ${esportal.live_gathers}`,
            ];

            let statuses = 0;

            if(statuses === arrayOfStatus.length) statuses = 0;
            const status = arrayOfStatus[statuses];
            client.user?.setPresence({
            activities: [
                {
                      name: status,
                      type: 'WATCHING',
                },
            ],
        })
    }, 60000)
#

nvm my teacher just came in a clutch and helped me fix it

#

xd

orchid glade
#

Anyone know what the deal is here:
DiscordJS randomly stops streaming arbitrary input (station url) after several hours

No biggies, plan was to simply restart voice stream when we detect that the bot has stopped speaking

Nope, DiscordJS voice status outputs as "Speaking" even when we're not 😠 wtf

keen gale
#

Do u guys make bots

orchid glade
#

I think I'm gonna have to use the external voice library because pretty sure I heard that v12 voice is known to be buggy as all hell

#

Shame really

keen gale
#

Who can make me a duck bot that has a verify system and a server stats?

#

?

feral aspen
#

You can learn a programming language and trying do it independently.

keen gale
#

My template

orchid glade
#

Emojihub

midnight swallow
orchid glade
spark flint
#

@rustic nova is this promo or-

feral aspen
rustic nova
#

Yes

orchid glade
spark flint
#

I’m no snitch but I don’t trust any link with Discord in unless it’s discord.com or discord.gift

feral aspen
#

It's a template, wot.

rustic nova
#

Is still promo basically

earnest phoenix
#

still an adv

keen gale
#

But it's my template

#

I copied it on my server

orchid glade
#

Interesting

spark flint
#

The discord scams had discord in at the start

feral aspen
#

I don't care if it was discord.gg or discord.com or discord.gg, unless it was other than the word Discord then I am concerned.

earnest phoenix
#

cut the topic topggJoy

feral aspen
crystal wigeon
#

is it possible to deploy sharded bot on multiple servers?

feral aspen
keen gale
crystal wigeon
#

i assume it would still reply multiple times

orchid glade
keen gale
#

It's discord.new

feral aspen
feral aspen
orchid glade
keen gale
#

How do u do rectangle boxes around words

feral aspen
#

I know scams are like Get your nitro at <myass>.beach

orchid glade
#

basically just mash the keyboard while making a half attempt at spelling it and you got your perfect phishing domain

keen gale
midnight swallow
keen gale
#

How

feral aspen
midnight swallow
#

To make it look good

feral aspen
keen gale
#

'This? '

midnight swallow
#

Bruh

#

Use ` on both sides

midnight swallow
feral aspen
keen gale
#

this

feral aspen
#

Do you mean This is a sentence inside a box.

keen gale
#

Oh

feral aspen
earnest phoenix
#

hes trying to markdown it

keen gale
#

i found how to use it

earnest phoenix
#

lmao

midnight swallow
#

😂I thought he was asking about the text used to decorate channels,😂 and he asked about this

feral aspen
earnest phoenix
#

you explained it in a complicated way

#

very

feral aspen
keen gale
#

does this work?

#

Oh cool

feral aspen
earnest phoenix
keen gale
#

ik

earnest phoenix
keen gale
#

Did

feral aspen
earnest phoenix
#

my discord is glitching

#

oh no

keen gale
#

How

earnest phoenix
#

nah jk man

midnight swallow
#

3+ years on discord, I don't even know how to copy a server template 😂

keen gale
#

🤡🤡🤡🤡

earnest phoenix
#

it did work

feral aspen
#

Helloooo.

earnest phoenix
#

`how is this thing works

#

`

#

there

feral aspen
#

Dude.

#

@rustic nova

keen gale
#

Jus view it

earnest phoenix
#

man send it again and you'll get muted

midnight swallow
#

You may get a warn, don't send em here

feral aspen
keen gale
#

We're do I do it then

crystal wigeon
#

;-;

feral aspen
crystal wigeon
midnight swallow
earnest phoenix
feral aspen
feral aspen
#

Where do people mostly ask for code support other than github?

rustic nova
#

here

feral aspen
#

Is Stackoverflow good?

feral aspen
rustic nova
#

reading previous question answers, yes

#

asking your own question, no

feral aspen
feral aspen
rustic nova
#

or your question might get locked for being a bad question

#

4head

feral aspen
hybrid cargo
earnest phoenix
hybrid cargo
earnest phoenix
#

yeah so true

#

github errorpilot mmLol

glacial vapor
#

this makes me feel happy i have done something instead of being lazy hnk_kek

cinder patio
#

@drowsy crag

earnest phoenix
half bay
hybrid cargo
earnest phoenix
#

me waiting for the mute

earnest phoenix
spark flint
#

It’s missing the 43 errors to tell you that