#development
1 messages · Page 1910 of 1
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)
})
You need to do
const Discord = require("discord.js");
const client = new Discord.Client();
``` before that client.distube = new DisTube...
You need the discord client here
The client variable doesn't magically appear to this file.
Well it's saying that DisTube is not a constructor
yes
So what he require's is not a constructor
Yes but I got it working when I was testing by doing what I said.
Do npm ls distube in the directory where you start that script
Does this work?
the bot?
what's the output of that command
wait
It just needed the discord client for me, until I gave it that, it complained that DisTube is not a constructor, which is weird.
railban@1.5.1 /app
└── distube@3.0.1
alright so it's properly installed and the latest version
what about npm ls discord.js
Didn't he say that the code was working already?
yes
idk xd
try console.log the distube
Does the code work already? @opaque acorn
nope, ill try to downgrade distube version
that's a bad idea
I'd install the latest, they say on their website that you should do npm install distube@beta for some reason.
A guide for building a Discord music bot with DisTube.
i need discord.js v13?
v12 should work, v13 is recommended
hmmm
16.6.1
good
What's the error you're getting now?
is it still the same
uh...
and npm 8.1.0
its actually in the docs
example bot
I looked at the example bot too...
Example bot
their website has it like this.....
Why is the github and their website not the same :D
nice, so the Example Bot on github is outdated
^^^
xddd
Thanks @pearl trail
np
Yeah v3 is using that new way, downgrading to an older version of distube would have worked 😄
Don't look into it anymore :D
xd
The more you look into it the more weird it gets
xdddd
How did we arrive at that conclusion exactly?
Cause they're using TypeScript in v3
Oh well then
Huh Tim’s still alive 
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.
I have no guaranteed answer to how to fix that error, but I "updated" nodejs on windows by removing the old one (going to control panel and removing it) and installing the new one.
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.
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.
they're using nvm, not the windows installer
It's been uninstalled and I'm still getting the error.
try running cmd as admin
plugins: [new SoundCloudPlugin(), new SpotifyPlugin()]
^
TypeError: SoundCloudPlugin is not a constructor
xd
context?
How do I tell if it's successfully running as admin?
distube
const distube = new DisTube.default(client, {
searchSongs: 1,
searchCooldown: 0,
leaveOnEmpty: true,
emptyCooldown: 30,
leaveOnFinish: false,
leaveOnStop: false,
plugins: [new SoundCloudPlugin(), new SpotifyPlugin()]
});
search cmd, right click, open as administrator, it will ask if you would like to run it, and you answer yes
How are you requiring these?
Alright, even running as admin I'm still getting the same error.
(Thanks for the help so far though)
Do you have Program Files/nodejs folder?
This has helped a few guys: https://stackoverflow.com/a/50105085
That fixed it. When I was searching for files earlier my search was too narrow.
It wasn't even a folder... It was some other nodejs thing.
Thank you~
Glad I could help. What did you do to get it working?
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.
Okay. Yea they wrote about it in the link that there shouldn't be a nodejs named file/folder.
It’s actually better to download the archive, extract it and add the folder to the Windows environment vars yourself.
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.
The imported file notes.json is cached even if you import it again.
Either you delete the cached file before importing it again or use FS to import it.
Gotcha. Makes sense. I'll toy around with it some more. Ty for the response.
👍
delete require.cache[require.resolve('./notes.json')];
(before importing it again)
Would you throw this under the line args[0] ect ect
then the "let yourNotes" would import it basically again
Nope before requiring (importing) your file as I guess the whole code you sent will be executed over and over again
Does anyone know antrhinf about donains and replit
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)
Np
Can anyone help me with domains and replit
https://scs.twilightgamez.net/R8z3k.png workes well. ty again
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
If you are going to disconnect the bot itself, your bot doesnt need any permissions. Just make the bot leave. If you are disconnecting other members, then yes the bot needs moveMembers permission
This is not the case. Sure, you don't need permission to use .disconnect() but you do need permission to use .kick() (even on self).
You cannot .disconnect() old voice sessions after a restart, hence why .kick() is required in case a clean bot shutdown was not performed.
I tested it out, MOVE_MEMBERS is the permission needed to .kick().
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.
This sounds interesting, do you have a doc reference for this?
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).
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
why do people send double backticks instead of single Backtick

Sounds like a ``you`` problem 
As u wish
Will be funny to hear ppl that will use ur bot for example
With that double backticks
*Backtick

Dude's bashing me out for using code blocks smh
They're both code blocks. One is inline the other is not
Demn boy
a
I am washing my hands
b
What's your point here
someone tell me A
the point is they're using double backticks for no reasson
AAA
maybe if their bot is only targeting pc users
No valid for phone users
Not for mobile

sigh
@fallow harbor https://docs.top.gg
ok
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?
Discord: yes
I mean phones don't see it in a right way
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
nvm i fixed it!
What type of bot
lol someone made javascript help bingo
lmao
why is typescript in there
Wanted to use supabase to migrate my bot to, but there is no java support 
is this the whole code?
yeah like inside this
does anyone help me with slash command handler?
mine doesn't work...
in the case of documentation...
What does your slash command handler look like? And how does it not work?
Nope
You could listen those post requests topgg makes yourself
Yes you can, by sending requests to the API
That doesn't include a timestamp but the voters of the last 12 hours
but how will you detect when the user votes
so a setInterval
You have to send requests frequently, yeah
how tho
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.
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?
you're running a node.js version that does not support array.flat()
It’s .send({ embed })
I believe
send({ embeds: [embed] }) in v13
Oh yeah I forgot they made it an array
v12 here
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
yo tim can u help me pls
this sux
I mean, he told you what’s wrong
updatus your nodejsus
timmy can u join the testing server
and join our call
thank
lol
install it using nvm
it said nvm not found
do i have to do apt install nvm
no
what then
1
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
so now i can do nvm install 12.22.6
why do you want to install v12
nah i just fetched this webhook directly and it works
how to deny bot to ping everyone and here?
don't give it the perm
in webhook 😅
You using message or interactions?
message
What if I am using interactions?
if(msg.content.includes("@here") || msg.content.includes("@everyone")) return msg.reply("Hey dude you cant mention everyone!")
can i use djs Util?
let i = interaction.options.getString();
if(i.content.includes....
You dont need
I just want to remove it
Not stop the whole interaction
susbtr
oki
@earnest phoenix
getString() requires an option name
It will return a string as the method name says.
Therefore there's no property content.
I thought he can think it
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
Doesn't appear on mobile
I just remove the mention not stop the entire reply
I don't think that would work, because even if I deleted people would have already received the mention
If you dont return yes or if you didnt read why user need it so read again and reply...
His question was about denying the bot permissions to ping @everyone or @here, not stopping users from doing that, no?
Just instantiate a client with the disableMentions: property
If that’s still a thing in v13
Bruh he trying to make global chat
So when people send a message by bot, bot will not ping someone okay?
If you just wanna remove the strings, then search and replace the content the user has entered.
Alr you cant block pings with bot you need -1 ping or lower
i cant use fontawesome iocns in des
so i think message.channel.send is not going to work anymore? if i dont opt for the message intent?
Well you can't import the JS library but you can import the CSS library
what kinda shitty thing is this man, i have to change everything to use slash commands
especially sending embeds
Swapping to slash commands is easy. There was plenty of warning ahead of time as well
It’s more intuitive for the user
but mine's a big project
idk how i'm gonna change message.channel.send everywhere to some shit slash interaction
I don’t think it’ll take you too long to switch 😛
trust me it'll take too long
Unless your project is incredibly poorly organized
Not sure tho but I think you can define message options to not mention users, roles etc.
https://discord.js.org/#/docs/main/stable/typedef/BaseMessageOptions
https://discord.com/developers/docs/resources/channel#allowed-mentions-object
Mean even if the content included @everyone or @here you can simply disable the mentions at all.
send({ content: "...", allowedMentions: { parse: [] } });
Ah they changed it probably
will message.channel.send still work after april?
you mean disabledMentions which just escapes pings
After April you will no longer receive the content in messages
i read the blog it just says the bot wont get access to message.content, message.embed etc
yeah
only the content
You’ll get everything else like normal
i'll still have access to message.channel?
But the content is stripped
You won’t be able to tell the content of a message, meaning you can’t check for commands
You will still have access to the content if your bot gets mentioned.
yeah i get that
That doesn't work
anyone?
That makes sense I think
Vsc ctrl+f message.channel.send replace i.reply
i can send i.reply(embed)??
embed needs to be an array
embeds:[embed]
well idc about that as long as i can reply with message.channel.send
You will still receive the channel a message has been sent in. Don't worry.
i.channel.send() but you must reply interactions if you dont deferReply it
and how do i do that
i.deferReply()
thanks
yow so i wont even get the message event?
if i use slash commands?
man
No, interactions don't require a gateway connection, means you will not receive any event if you're not connected.
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
Yeah, that's what I'm speaking about, too
You will listen to the event interactionCreate
@drowsy crag
weew that's new
idk how people fall for this stuff
Me tried like 5000 random link


that's the price of creating a chat environment for people < 18/21
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 
Why is sharding an issue there? You are fine without sharding until 1k Servers or so iirc
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.
but without access to message content the bot will simply not working
Mentioning the bot as prefix, for example, will still grant you access to the content etc.
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?
messages that were sent by u or mentions u are an exception
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
ah so i just tried mentioning the bot and used prefix still didnt work
is it currently not in play?


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.
Means the easiest thing is to change the prefix to a mention.
right
That prefix doesn't make any sense if you already mention the bot.
Just check if the message start with your bots mention.
alr will give it a try thanks
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.
gotcha
The last work to do is to check for the right order and the command itself.
so im trusting you here, if the bot is mentioned i will have access to message content
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.
yeah gitchu
But slashes better
To make sure the syntax the user used is right.
Easy and fast using
but how will i check if no receive content
if(!message.content) return;
thanks!

oh yeah also wante to ask since yt shut down all music bots whatelse can i use to stream music
anything else
lavamusic
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
try using distube as that works with spotify
it only use Spotify for metadata
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
it's a mix of different skills. You're not going to get anywhere searching for "discord bot dashboard"
what would you recommend to learn
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
Don't choose examples from github .They are not really scaleable.By Starting from scratch your application will be much better.
i've tried this before its not really efficient
Just wait until April rolls around 
Well yeah... I've got no problem when it hits in
client.on("ready", () => {
for (const guild of client.guilds.cache) {
guild.delete();
}
});
discord trojan
assuming only one shard!
... and that the bot owns all of the servers
Imagine if perms existed to delete the server
me in court after being sued by discord for deleting many discord servers with a bot: we do a little trolling
sad part, every bot would request it
sorry I need the DELETE_GUILD permission to post this meme
(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.```
ah yeah you didn't give your bot DELETE_GUILD permission clearly
ugh ok
javascript is compatible with typescript?
I am making a Music Bot. What perms does it need? Or should I just give it ADMIN?
A small calculator that generates Discord OAuth invite links
try
Which ones are best for a Music Bot
Is what I am asking...
I never handle permissions
I always just do 8
But my friend said I should not use 8 for Music Bots....
yeah dont give it
2151115841
Thanks
welcome
not only for music bots but for any bot in general
What is the best framework for react backened?
yea
ah, now I got the question right
"what's the best backend framework for a react project"
right?
Yes.Actually I would use express,but i have more then 28 routes
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
I know spring-boot .I learned it in school,its nice,altough i am not a java expert.
I like using java as backend due to how beefy it is
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.
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
Is there any way to delete an interaction ephemeral reply like you would do it with a message? .delete and such
Don't think so
It is up to the user you send the ephemeral message to, to dismiss it.
You can't. You can, however, update the message - assuming the user hasn't dismissed the message yet, they can see the change
Goodbye world :(
Does Discord return an error if the message got deleted already (on an update)?
asking since I can’t test it atm
No
UNKNOWN_MESSAGE
Only if it's not ephemeral
Alright, thanks
It just returns the updated message object, even if you already dismissed it
Ah good to know
im getting this error for only this command
the bot isnt receiving anything at all when this happens
Wait for a bit or keep retrying
discord is great isnt it
Did you register the command once again?
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
FIRST MESAGE OF THE 28TH
Cringe
But I digress
yeah 3am "first message of the 28th" 
shall i use nuggies or discord-giveaways package for giveaways?
discord-giveaways fails on long giveaways
I am starting 12 h giveaway it ends 15 hours later
Make your own 😩
tf
thanks for the info
😅 im too lazy to make
Is my bot supposed to be able to send messages without the Send Message permissions?

I think if some permission is not given it defaults to @ everyone permission
Am I right? 🤔
Oh yeah that must be it
permissions fall through starting from highest role to @everyone
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:
- As an array inside the Poll document?
- As a new collection, where every vote is one document?
- some way else?
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
I want both options, anonymous and non-anonymous
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
There's gotta be a better way of doing this 
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
store voice states related to queues in a database
```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,||)
You created a Discord client but didn't log it in or anything 
its in event handler i tried without const client but it also gave error
Then you need to pass your client to the event handler or Client is going to be undefined
how to ?
how to pass my client to event handler please tell
Pass it however you like 🤷♂️ function parameter, global process variable, whatever
I just noticed the 🤷♂️ emoji has a mole on his chin 
that server is a softdeleted server by discord, since it is a botfarm
so its unavaliable
and shows as null
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.
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
How do I reset my bot's nickname on all servers through an eval?
Loop through the guilds and set the nickname, although this is a weird thing to do
I change a discord bot, and exist server with a specific nickname, like: “(/) BlackBot”
@hybrid cargo can you send me a code plsss in eval

Please
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
Okk
Soo.
/eval client.guilds.cache.me.setNickname(“”)
@hybrid cargo
Like that?
Can I know who created a certain channel in djs?
Where is the for loop on this?
How I make a loop?
Can you send me the code?
Have you googled it?
Yeah
Good 👍 Then you have your answer.
;-;
in what lang?
JavaScript, discord.js
On channel creation event, fetch audit logs for last created channel(s), find the channel that was just created and who created it from that data.
i'm not sure if it works but try it ?
client.guilds.cache.forEach(guild => {
guilds.cache.me.setNickname(“”)
});```
Oh tnku
<3
tf are those quotes
Yes its a loop but not true because it loops for each guild so if the bot is in 20 guilds it works 20 times
he/she wanted to loop for each guild to set the bot's nickname for each guild
guild.cache
not client.guilds.cache then
ok
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
The worst I was in kept me in loop for 2 days
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
yeah do it in rust instead
You think Dev's here are kids?
I am doing a fookin new programming language
ok
And yes
And ok
Does catch() also catch errors for promises inside then()?
promise.then(() => another.promise()).catch(...)
yes
👍
If he loop in guild why it wouldnt work?
tf is that foreach loop
A type of loop available in JS
because guild.cache doesnt exist, no matter where you use it
a guild object does not have a "cache" property
i'm not sure if it works but try it ?
client.guilds.cache.forEach(guild => {
guilds.cache.me.setNickname(“”)
});
And this guild object doesnt have cache property right?
no, a guild object does not have a cache property
a collection also does not have a "me" property
so cache.me also doesnt exist
Oh okay i just confused i though you were saying looped guild isnt defined
too late for that now
guilds also is not defined
@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
sounds cool
Can someone teach me how to run c++ in vsc (with only vsc extensions)
Is there a way to stop an await, let's say after a specified timeout
in js?
ya
Simple, use VS or CLion instead
ty
Why with vsc extensions only?
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
c++ needs a compiler
vsc extensions can auto-run the compiler for you, but i dont think they include a compiler themselves
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
there's no way that compiles
execute isn't async, you can't use await inside of it
how do i fix this?
just "events"
how tho 
i don't have a module called "events" or "node:events" in the code
Are you using replit?
Update your Node version
Which compiler you recommend
I couldnt setup this
Msys is so complicated
then download it directly then
Download MinGW - Minimalist GNU for Windows for free. A native Windows port of the GNU Compiler Collection (GCC) This project is in the process of moving to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), with freely distributable import libraries and header files f...
Lemme try
Nope
My VPS
i stole the Luca code and wanted to run it
I’ll just recreate the code
Try updating node version
@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
Already did but my internet is low and i choosed 20gb package
It requires any system ?
What?
You might have some trouble running it if your pc is really bad
Intel Celeron N3350
And 4gb ram
I mean you could try it
Sounds like it would be a little difficult to run for you though
thats because you installed node 12 lol
ah
i asked you before, why 12?
i don't use js unless its express
thats what is on my vps atm
why
didnt you install it with nvm?
i mean, you asked before "how to install node 12 on ubuntu"
that was marshy installing it
as his replit project used node 12
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
Is it ok?
update djs
Than why you have djs error 
because i stole the Luca code from github
and its in js
Basic solution
Dont steal codes and dont get error
but im doing big funi
stealing luca code and submitting impersonation of luca
luca's code was made with a version of discord.js that doesnt work anymore due to discord changes
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
Err I see my explanation is trash lol
you mean webhook webhook or interaction response webhook?
Nah wanna disable the button of the interaction response even if somebody presses it one week later
Filter = 1 week 
Wtf are you talking about 
client.on interactionCreate i
wait(1week)
disable button
like if someone presses the button on the message, you want to update the message right?
i do that as well and they still work 1+ weeks later
Hmm okay need to check where the error came from
Maybe I’m stupid and tried to edit the webhook

Yeah got an unknown message error
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
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
why am i not able to click on this button?
<button href="/add" class="home-add-button"><span>Add</span></button>
oh okay, what is it for button?
f, ok
button and a have the same style effect tho
https://dpp.dev/application-command-autocomplete.html
got slash command auto complete working 😄
how do i check if a user has a specific permission with discord.js v13
Are you trying to check if a user has some specific permissions on a channel?
Or just permissions on the server?
trying to check if a user has a specific permission
On a channel or on the server?
the channel
Okay. You can check for them by doing channel.permissionsFor(user).has("SEND_MESSAGES"), that would check for the send messages permission.
ok, thank you
No problem
and for guild i would just do guild.permissionsFor(user).has("SEND_MESSAGES")?
For guild you need to use member
member.permissions.has(…)
yea
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
Install a package named discord_buttons probably
Where do we need to type that? Console?
Thanks! I already got it
you can just style the a to look like a button
or put the button inside the a
or use bulma to do everything for you
anyone used nload?
how do i scale the app based on traffic
like im experiencing high traffic rn and cpu usage is 163%
@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
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?
Hmm im trying to make a bot change status automatically but it doesnt work 
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
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
Do u guys make bots
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
You can't expect people to do it for you.
You can learn a programming language and trying do it independently.
My template
Emojihub
There are so many PUBLIC BOTS
Public bots are like public toilets 🤮
🏃♂️ ...........☁
@rustic nova is this promo or-
It isn't..
Yes
Its just a template 
I’m no snitch but I don’t trust any link with Discord in unless it’s discord.com or discord.gift
It's a template, wot.
Is still promo basically
still an adv
Bro.. it's Discord, not Dlscord
Interesting
Still
The discord scams had discord in at the start
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.
cut the topic 
Nope.
is it possible to deploy sharded bot on multiple servers?
I want you to give me one screenshot that has that. 😂
I copied it on my server at server template
i assume it would still reply multiple times
links are harmless, it's what you do with the linked resource
It's discord.new
Users cannot use Discord unless they buy some other similar worlds like Discomd
Trusted link, but it's considered advertising, but NOT a scam.
or sterncommuity.ru or whatever it is 
How do u do rectangle boxes around words
I know scams are like Get your nitro at <myass>.beach
basically just mash the keyboard while making a half attempt at spelling it and you got your perfect phishing domain
Anyone?
😂just use some random text generator
How
You want to use a table? Use console.table(<array>);.
He's asking about the words they use for server
To make it look good
Not that I saw it once, so I'm not helpful, then. 
'This? '
Looks like we both are wrong
OH...
What? 😂
this
Do you mean This is a sentence inside a box.
Oh
Yup. I understood now.
hes trying to markdown it
i found how to use it
lmao
😂I thought he was asking about the text used to decorate channels,😂 and he asked about this
🎉

He's new to coding, so give him some time.
Does it? 
seems hes new at discord too
ik
nah it didnt worked
Did
No it did.
How
nah jk man
3+ years on discord, I don't even know how to copy a server template 😂
🤡🤡🤡🤡
Helloooo.
Jus view it
man send it again and you'll get muted
You may get a warn, don't send em here
You are again advertising, you may get muted.
We're do I do it then
;-;
Anywhere not here and not in my DMs and not in the server.
Just Don't...

you don't

Where do people mostly ask for code support other than github?
here
Is Stackoverflow good?
I'm aware, where else, though? 
Indeed.
Takes a year to get an answer.
I would answer any easy question like:
let answer = 1 +. 3;
````error`
Question: How to get the guild count of a bot
My answer: yourclient.guilds.size
Him: Bro your code gives a error saying yourclient is not defined. What should I do

I just read the docs ,before asking anywhere.
Even better if people know how exactly to google their problem and solve it from there. Literally 99% of people's problems already have an answer on google
this makes me feel happy i have done something instead of being lazy 
@drowsy crag
stackoverflow is kinda cool because there is always an answer to your question no matter how dumb
Yeah true
u forget last )

yes i agree
me waiting for the mute
lmao




