#development
1 messages · Page 1161 of 1
i dont have any knowledge on java, i have found a "discord.js" for a bot. can someone help me add it to my server please?
Wait what
@opaque swift I can help you invite your bot to your server
You are missing dependencies for node-gyp, wait a sec I think I have a list of dependencies somewhere
i created a bot from discords web site and invited to my server, however, it is offline and kinda empty. I want to add that app to my bot and activate it on my server
First, go to discord.com/developers/applications, second, go to your application and then go to OAuth2, check BOT and then copy and paste the link that discord renegated you
can we go to dm? so we dont fill this chat with many stuff 😄
You need to install gcc
Or other C/C++ compiler toolchain if you prefer
As stated here (https://github.com/nodejs/node-gyp#on-unix)
And python
First, go to discord.com/developers/applications, second, go to your application and then go to OAuth2, check BOT and then copy and paste the link that discord renegated you
@earnest phoenix where do i paste the link
Browser
👍
now i have a file named discord.js, how do i install this to my bot?
nice
You need to host your bot
Read trough this a bit
You need to run your code
can you please help me through dm please
Using node
node.js?
Yes
ok i opened node.js and i see something like a cmd file
Youre on windows?
yes
Is nodejs in your path?
i dont know
v14.0.0
That means it is in your path
great 😄
do i cd on promt? or node.js
i dont have it
Did you make this code?
no i found it on github
Ah
i asked the author and said he wont help me and i have to use it myself
Did you download all the files?
Can you link the repo
i will send you via dm
hello, im using opusscript for my music system, while im playing music and there is error , and no matter what error, even one that doesnt matter, opusscript making the app to get crashed
anyone here have a solution ?
https://hastebin.com/ewucutinix.js my bot is not playing my music stream is come "Error [VOICE_PLAY_INTERFACE_BAD_TYPE]: Unknown stream type"
V12 dscord.js nasıl indircem
Do i use role.id as a parameter for the id of the role?
okay
can someone help?
Yes
How to make a message sent with python 3.0
When I try to run ping command nothing happen, no error
How to make a message sent with python 3.0
@steel mountain ctx.send("blabla")
yes
For discord bot
This?
He need to learn pyhton first
*python
mitrek can you help me now
no i made it
is there anyone that can help me see more than cached users my bot is connected to
Fetch your users, and get the size of the response, optionally disable caching the fetched users
welll you see im new to coding 
k
How do i get this emojis? 1️⃣ 2️⃣ 3️⃣ ?
@wary flame now it says target guild not defind
@floral creek ?
How do i get this emojis? 1️⃣ 2️⃣ 3️⃣ ?
wdym ctx.guild.name
Hey, I am watching a tutorial vid on yt to turn my bot to online, he says to type node . to get it online but he says something else, pls check it here and help me https://youtu.be/j_sD9udZnCk?t=803
Code your own Discord bot! Coding a discord bot isn't hard at all! with a couple of simple lines you can get a bot up and running on your server. Make sure to stay tuned for upcoming discord coding tutorials. Discord.js makes it very easy to code your own bot without having to...
yes node .
I am from Greece and he says something about it
token leaked 
Just don't turn it off
You sure? my computer will blow up
Nah i mean if i will run it like a week or 2 weeks

@earnest phoenix use host
what hosting site you recommend me to use? @weak rain
paid or free?
free
i dont have the money for hosting
hm
Yeah
Can some1 help me with this error in the console?
(node:6348) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
Ping me if possible.
Why when I try to start my bot by typing node . it says MODULE NOT FOUND?
@earnest phoenix if node . doesnt work , try to do node run index.js
Why it shows up and how can I fix it?
Still
Can someone help me with that? ^
(node:6348) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
@indigo cobalt not really an errors its kind of a warning
afaik
@earnest phoenix
i probably am wrong
What can I do to get that warning off?
i have 10000% doubt in my skills
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'C:\Users\User\Desktop\Poll Bot\run'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
idk Ty for the help Ig
IT literally says that in the message when you can do
i never tried so i have no idea
This is shown every time I try to start my bot
IT literally says that in the message when you can do
i never tried so i have no idea
@small prairie I tryed it gives and error.
client.setMaxListeners() ?
Yes.
kEWL
Ill search.
or just dont have so many listeners are you okay
Ty for the help @small prairie .
why do you have so many listeners
bc I turn on and off the bot a lot of times idk
idk It only apears a lot.
please don't tell me you have a message listener for each command
Listener. Like what?
lol
Im new at this xd.
how would i get lavalink stats with erelajs rewrite
Ok.
i have client.manager.nodes.get("host").stats; but it returns 'stats' of undefined
// good
client.on("message", message => {
// check if command 1, run command 2
// check if command 2, run command 2
// check if command 3, run command 3
// etc...
})
// bad, dont do this
client.on("message", message => {
// check if command 1, run command 1
})
client.on("message", message => {
// check if command 2, run command 2
})
client.on("message", message => {
// check if command 3, run command 3
})
I have a command handler but Is almost like that.
the warning is being caused by having too many .on("message")
Ah ok.
you should only have one for each event
`command(client, 'help', message => {
}`
message.channel.send(embedTranslation(json.text[0]));```
the error of ```TypeError: Cannot read property '0' of undefined```
you should only have one for each event
@quartz kindle Ok thank you.
json.text is undefined
message.channel.send(embedTranslation(json.text[0]));
the error ofTypeError: Cannot read property '0' of undefined
@astral yoke json.text is undefined.
ty
`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandex_API}&text=${encodeURI(
text
)}&lang=${langCode}`
);
const json = await res.json();``` that should work though?
Try and find out
thats the same code
im confused why its undefined
`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandex_API}&text=${encodeURI(
text
)}&lang=${langCode}`
);
const json = await res.json();
message.channel.send(embedTranslation(json.text[0]));```
thats everything mostly
Do you have a json.text?
ohh
wouldnt he get it from res.json()?
because res is defined fetching the url via node-fetch package
someone wants code for code? i will give him a serverinfo code/ban/kick for a purge command in a case
no
in brainfuck and let them struggle with translating it
bd-script
smh
discord.js dependicies are inaccesible rn
weird
bd-script
@quartz kindle
wdym discord.js dependencies are inaccessible?
look at the docs main website
it says that
but actually the are up to date
maybe a glitch on the website
can you show a pic where it says that?
you download, and then you install ffmpeg
@low shard what ide are you using?
does a getinvite command where your bot makes an invite any guild its in against tos?
@midnight blaze like studio code ?
Yes
@low shard then it should work w/o problem. You installed ffmpeg?
Yep
To be specific, if the server administration/members have not consented to having an invite created, that is a violation of Discord Developer Policy.
what exactly does it says
how about you make a damn screenshot
I want to see exactly what it is written on it
Whenver I restart Ubuntu, I seem to get this error? Is it possible to fix this? I've tried to Google it and I couldn't find anything related to what I have as it works fine but always boots with this error for some reason and it's concerning. Thanks in advance
The system boots fine, but just shows this error on start up and then boots
I'm sorry if this isn't meant to go here, but I thought this was my best bet for getting a serious, relevant answer
(if you have an answer or a question, you can ping or DM me with it, so I see it)
This isn't the same error I received, and my system also boots perfectly as if nothing was wrong so I'm confused
Was talking to my friend about it
Ik, but it contains relevant information
He said I should run
sudo update-initramfs -u
If the system works, open a terminal and type 'sudo update-initramfs -u'
If you read the thread in that link it'll explain why he said you should run that for your issue
Ok
How can I ban an user with Discord.js that I got with a mention? I'm using Discord.js 11.2.1, and I can't find a solution...
A mention is just <@userId>
D.js has a function for Banning users in the docs
I think you just supply the user id (and maybe the client context?)
I just want to know the function how to ban, when I already have the map of the user I want to ban.
Like I said, that function is available in the discord.js docs
Like I said, I'm using an older version and can't find anything
you should upgrade, that version will be deprecated on october 7th
Yeah
you should upgrade, that version will be deprecated on october 7th
@pale vessel Completely, or is just the API domain no longer supported?
And I thought this was in november...
But The Discord System Notification said on November 7th the domain, and on Octover 6th just the verification process..?
Restrictions will take place after either of those dates and verification will be officially enforced
one of the enforcements would be intents that old versions of discord.js don't support
Ok, is it a very big change to upgrade from v11 th the newest?
Any major version change in libraries should be assumed as such.
Changelog should document deprecations
Would a SELECT * FROM X WHERE XXX IS NOT NULL; mysql query every 60 seconds in a table with 300k rows considered bad performant?
yes
Which Discord.js library versions are already supporting the future changes of the Discord API on October 6th and November 7th?
I think 11.6.something supports it
In general it's a good idea to avoid: wildcards, functions, recursion, and unnecessary conditionals
And all of v12
Why avoid functions in SQL?
Functions require additional computing overhead
thx
Weren't you already going to use some type (native lang) if you're using one in sql
Well what I mean by that specifically is scalar-valued functions in the WHERE clause
oh
Yo guys I made an npm package
And that's because you can't use indexes with that approach
(that sucks)
SELECT * is not the taxing part unless you're fetching shit tons of data
UMM
That usage approach causes more network and I/O activity, so it affects the query performance negatively because of the more resource consumption. You should really filter it by columns you want to retrieve.
UMM
@delicate shore wut
@faint prism I have a notifications column that if it is not null, it means that user has a notification pending
So I get * where notification is not null, and send all notifications to those users
What are your column headers?
What do you mean by headers?
what is XXX in the FROM clause
SELECT * FROM users WHERE pendingNotifications IS NOT NULL;
Right so, pendingNotifications is a column. What columns are you selecting? Do you need every single one for a row in users?
Uh.., I have a problem with my bot where... for some reason it responds 9 times?!! in every command?
You've tried to turn your bot on 9 times
Oh! I get what you are saying @faint prism
or your using 9 apps/hostings to keep your bot online
Yeah i'm using about 3 columns out of 10
you are definitively
I only have 1 node on
Yeah i'm using about 3 columns out of 10
@crisp geyser Then an optimization would be to select COL1, COL2, COL3 From ...
2 choices: youre somehow running it 9 times OR you execute commands 9 times
Well, no. But, I get this weird thing:
I will do that, thanks!
(node:6400) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 ready listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
lol
Memory Leak
l0l
lol
(node:6400) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 ready listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
@stable eagle You're definitely doing something wrong if you're introducing a memory leak
idk what I did tho
hey guys I just need some regex help.... how can I match the spaces right after the digit (in red) but not all of the spaces between the words?
nvm im dumb
i forgot the space
this is my node, only 1 is running
OK
or just your entire index.js
Well right away there are a bunch of things that are wrong there
Your entire code is inside that for loop
Take it out of the for loop and put it outside
Also your ready event is inside your message event
This is how your code should look```js
// imports
for (const file of commandFiles) {
// some code
}
bot.on("ready", () => {
// some code
});
bot.on("message", msg => {
// some code
});
bot.login(/* token */);```
but right now, the last three parts are inside the first
why does this error Canvas.registerFont(`${process.cwd()}/assets/fonts/RobotoRegular.ttf`, "RobotoRegular") TypeError: Canvas.registerFont is not a function
because the for loop is closed } at the very end of the files
@astral yoke show code
Hey,
can someone tell me how to make a temp vc bot?
that is the code
Are you sure you made no typo
That file @astral yoke
Hey,
can someone tell me how to make a temp vc bot?
@radiant patio https://dontasktoask.com
also that's spoonfeeding
hastebin
const { createCanvas, loadImage } = require('canvas');
const { MessageAttachment } = require('discord.js');
const { get } = require('node-superfetch');
const db = require('quick.db');
const { crFormat } = require('../functions')
Canvas.registerFont(`${process.cwd()}/assets/fonts/RobotoRegular.ttf`, "RobotoRegular")
Canvas.registerFont(`${process.cwd()}/assets/fonts/courbd.ttf`, "Courier New")
Canvas.registerFont(`${process.cwd()}/assets/fonts/Impact.ttf`, "Impact")```
is that good for the error
const { createCanvas, loadImage, registerFont } = require('canvas');```
wtf
ty
np
Oh my god, CI/CD pipelines are so nice
const { createCanvas, loadImage, registerFont } = require('canvas');
const { MessageAttachment } = require('discord.js');
const { get } = require('node-superfetch');
const db = require('quick.db');
const { crFormat } = require('../functions')
registerFont(`${process.cwd()}/assets/fonts/RobotoRegular.ttf`, "RobotoRegular")
registerFont(`${process.cwd()}/assets/fonts/courbd.ttf`, "Courier New")
registerFont(`${process.cwd()}/assets/fonts/Impact.ttf`, "Impact")``` would i do it like that @opaque eagle ?
yws
@radiant patio https://dontasktoask.com
@earnest phoenix I ask if someone knows how to...
Just ask, don't bother asking "if someone knows". ||ie Read the linked website||
Maybe someone does, what's the actual question?
´how to make that system...
Read the site
cuz I dont know
Please
wtf
yes...!?
@opaque eagle Alright, I edited my index.js file to what you said, but it made the console.log log the message inside of it 9 times for some reason
´so how to make a bot, that when someone enters a specific vc than it will make a personal vc for him
like that
hmmm
@earnest phoenix Only 1 node is on
nope
What does that imply, Milo?
well,
´so how to make a bot, that when someone enters a specific vc than it will make a personal vc for him
like that
@radiant patio maybe someone can
They asked you which one of either you use
Do you know how to code
bruh
@earnest phoenix it's both, but .once only executes once no matter how many times it is emitted
What's the library you use?
you mean like js
´so how to make a bot, that when someone enters a specific vc than it will make a personal vc for him
like that
@radiant patio you described the process quite clearly yourself, watch the event where users join a vc (voice state update), then create a vc and map the channel to the user, then move the user to the vc. After the user leaves the vc (listen to the voice state update event), check the map to find the channel of the user's vc, then delete the channel.
You should try to figure smth out
Ask us
We could help
Or just hire someone to make a bot if you don't want to code
But we won't spoonfeed
Ask us
(which is what they did, but you misunderstood everything they said or haven't been anywhere near helpful from the very beginning)
(which is what they did, but you misunderstood everything they said or haven't been anywhere near helpful from the very beginning)
(because i literally dunno how to do that)
when you play song
It stop him in the middle anyone know why?
Depends on the lib
Are you restarting?
@golden condor yes
That's why
Get discord.py[voice] for python
F
and i use jks
It stops when you restart
js no py
ok
@golden condor no
The ffmpeg process is terminated
its stop in the middle
What do you mean no
of the song
You are restarting
i dont restart
Therefore the stream will immediately stop
You just said you were?
What the fuck
Restarting your bot
i dont restart
What??
Because you are restarting
i just restart when i upgrade my code
@low shard
You say
You can code with music, I thought this was #memes-and-media
https://hastebin.com/sogebodifu.cs idk is something is causing a duplicate in my index.js file, but my bot responds to everything 9 times?? And no, I don't have 9 nodes running at once, only 1.
sorry man
Do you login to the client multiple times?
Nope
Hh
@stable eagle first of all please use else if 
How many message listeners do you have?
@golden condor his entire code is inside his for loop that loads the commands
I told him that earlier but he won't understand
Ah
Jjj
Yes so you have 9 message listeners
How can I check?
hey
when i play song It stop him in the middle anyone know why?
i dont restart the bot
Move the listener outside the loop
^
hey
when i play song It stop him in the middle anyone know why?
i dont restart the bot
what i need to give
Code? Error?
hastebin
and im not gonna share my code but my code is good
I understand why stack overflow people are so to the point now
cause i try run it on glitch
My brain aneurysms are back again
and its work fine
My brain aneurysms are back again
F
..you arent providing us with any info and expect us to help
@low shard you are using glitch. Whenver you type anything in glitch, it restarts. Also glitch doesn't stablely run ffmpeg, so there is your answer.
@golden condor i dont use glitch
Don't use glitch
I understand why stack overflow people are so to the point now
yeah when I posted my first stack overflow question i didn't provide as much detail and i literally forgot discord.js docs were a thing
i use vs
i need help
You just said--
ok
i say
cause i try run it on glitch
@low shard
are you using the glitch extension?
in the middle
Do you have ffmpeg on your pc?
my server i am making for my bot idk what roles to add and you guys look like you know what tp do
eh what
@golden condor yep
Hm
my server i am making for my bot idk what roles to add and you guys look like you know what tp do
@vernal sorrel not the place to ask
oh ok
I'm trying to make a command handler, and i've finally finished it, But I get no errors and my bot doesn't respond, Making bot in d.js, Code https://hastebin.com/jofiranopo.js
Poor guy is being redirected everywhere
Support told him to come here
Here you tell him not here

@golden condor hm ?
If you want to make a command handler why are you mapping the arg to specific commands in the collection @still merlin
The whole point of a command handler is so you won't have to do what you're doing in lines 31-43
hey
when i play song It stop him in the middle anyone know why?
i dont restart the bot
youtube is kicking you off the connection
no it will not
the api key is not involved in you scraping the data lol
lol
I'm trying to make a command handler, and i've finally finished it, But I get no errors and my bot doesn't respond, Making bot in d.js, Code https://hastebin.com/jofiranopo.js
@still merlin wait wait, why are you switching args and not command? XD
@earnest phoenix ?
why are you switching anything at all
yeah that makes sense as well
How do i add a gif in a userinfo command
@still merlin use client.commands.has and then client.commands.get
Like for some people they have a pfp with a gif
if you're using ffmpeg you can instruct it to reconnect, otherwise you need to buffer the content and create a duplex buffer so you can both send the audio data as it's incoming and buffer it elsewhere in memory
it's complicated shit and requires knowledge which i doubt you have
also it probably works on glitch because the bandwidth is fast enough to download everything without being kicked off
a PSA too, glitch is not powerful enough to handle music bots if you're going to be streaming in over 5 guilds lol
case 'createrole':
message.delete()
if (!message.guild.me.hasPermission("MANAGE_ROLES")) {
return message.channel.send("I don't have permission to that, please give me `MANAGE_ROLES` permissions");
}
if(message.author.id != '723081690792067143' && !message.member.hasPermission('ADMINISTRATOR')){
message.reply('you dont have the premissions to use this command!');
return;
}
if(!args[1]) return message.channel.send('you need to type what the role name should be.').then((message) => {
setTimeout(function() {
message.delete()
}, 3500)})
message.guild.roles.create({
data: {
name: args[1],
color: "RANDOM",
}
})
message.channel.send(`role named: **${args[1]}** added! (permissions: __normal__)`)
break;
why does it says: Cannot access 'args' before initialization
Because you tried to access args before initializing it
because you cannot access something before you initialize it
Avatar*
read the error 🤦♂️
No?
read the error 🤦♂️
@opaque eagle then how do i install it?
Install what
initialize*
this channel is making me lose brain cells again
@earnest phoenix how i do it
^
do research
What do you need args to be programmatically?
js
I put this .setImage(member.user.displayAvatarURL()) but it just shows images
im on phone, im not going to explain to you how to pipe and buffer, you have google for that
duplex streaming is heavily complicated
console.log(num); // throws error, because "num" isn't defined yet
let num = 2; // NOW num would be defined
program reads your code like it's a book
@earnest phoenix what google
Woogle
google google, click the first result, and then you should be at google
What do you need
argsto be programmatically?
@slender thistle the args[1] need to be the role name.
What do you define args as, anywhere in the code?
how to make help with pages
react to the message -> await the reactions -> edit message to different embed based on reaction
@slender thistle
i only switched him
switch (args[0]){
thats where my cases are

but how to do this
what library
discord.js
and message#react
hm
or u could get one of those packages on npm
Is it simple to create a reactionrole bot?
depends
it can be simple depending on your coding skill and what your goals of it is
Oh
someone can help me for the set welcome channel (in python) ? i use SQLite for the db
code? or errors?
im prob asking too much of dbl but is anyone here familiar with avx simd instructions
Where is general chat?
You think anyone here knows anything about actual computer science?
Ok
@amber fractal lemme cheat in my homework alone >:(
uhh not sure if this is the right channel but do all bots have to be modular? example: you can control mee6 from a flask server/website
is there anyway i can force npm to NOT install certain packages even if they are required by other packages. I use levelup because leveldown wrecks my stuff for some reason and the other dependencies work fine with levelup but if i run npm install to update my package configuration the whole thing goes shenanigans trying to install leveldown
@untold juniper
my bot keeps killing itself exited with code [0] via signal [SIGKILL] starting in -fork mode- online
Pm2 is restarting it tho but still
this is PM2's log
@earnest phoenix do you mean you have two packages that require two different versions?
no
is there anyway i can force npm to NOT install certain packages even if they are required by other packages. I use levelup because leveldown wrecks my stuff for some reason and the other dependencies work fine with levelup but if i run
npm installto update my package configuration the whole thing goes shenanigans trying to install leveldown
@earnest phoenix if its in the package's Package.json it will be installed
i think u can edit the file but never tried myself
i just want it to NOT install leveldown because my dependencies work fine with levelup and leveldown just wrecks npm
fixed
it was dumbass me to add it as a dependency
If i wanted to make a bot for an rpg, what would be the best library for it?
or
npm uninstall leveldown
@solemn latch if he upadtes the packages usingnpm iit would be reinstalled
updates*
well i know i'm using node.js
you cant remove dependencies from the package, that's the maintainers job
Some package maintainers are stupid
my bot keeps killing itself
exited with code [0] via signal [SIGKILL] starting in -fork mode- online
Pm2 is restarting it tho but still
so leveldown is a dependancy of levelup?
@solemn latch it's the reverse
but leveldown sucks
nvm i just prevented it from installing
it was dumbass me to add it as a dependency
ah yeah, just remove it from your package then
PM2 | App [bot:0] starting in -fork mode-
PM2 | App [bot:0] online
PM2 | App [bot:0] exited with code [0] via signal [SIGKILL]
PM2 | App [bot:0] starting in -fork mode-
PM2 | App [bot:0] online
PM2 | App [bot:0] exited with code [0] via signal [SIGKILL]
PM2 | App [bot:0] starting in -fork mode-
PM2 | App [bot:0] online
Pm2 is literally spamming this in logs every 30 secs or something idk
This happens when a bot is restarted afaik
You're sending sigkill somehow
process.exit?
process.exit(0) is sigkill I believe
Ye i checked my code
its only in one place !restart command which only i have access to
and when i test it using node index.js
the server is just hanged for a moment
and then it prints
Killed
pretty sure if your process hits a ram limit(max-memory or something) it also does a sigkill
Hey
I wanna make a dead command for my bot
in which the project kills itself in case of emergency
so it will be something process.exit()?
If its in Pm2 or any process manager process.exit wont work i think
or does pm2 restart process.exit(1)?
if your using a process manager the bot will auto restart
ye
process.exit = ctrl + c
my pm2 restarts my processes
then await it

only shutdown
await process.exit(1); await client.connect();
🤔
Wait how about you just <Client>.destroy()
let devs = ["587663056046391302"]; //CHANGE THIS TO YOUR ID(S)
if (!devs.includes(msg.author.id)) {
return true;
} else {
process.exit();
}```
I did this but it restarts it
then its restarted i think, ive only tried client.disconnect not process.exit in this case
it will just restart
i think u need to provide an wxit code
but thats just creating a new line
Ok but i think
not connecting back
why the fuck will i ever need a kill command
hey
when i play song It stop him in the middle anyone know why?
i dont restart the bot\
Also u can create another file where u can write something while doing !kill command and check that file when you client.login
depends on the lib
o
hey
when i play song It stop him in the middle anyone know why?
i dont restart the bot
@low shard any error/what are you using?
@small prairie no errors
lang/libs?
wdym what are you using
i told you why
I think about it and came to conclusion
||why the fuck will i ever need a kill command||
youtube cuts off the connection because you're hanging it for too long
@small prairie js
i mean kill isnt a bad thing but ok
Cry answered you
youtube cuts off the connection because you're hanging it for too long
@earnest phoenix so what i need to do
?
i also told you that
you can say again

i dont see it
lol
if you're using ffmpeg you can instruct it to reconnect, or you can buffer realtime (which is complicated)
I removed some parts of my code and it isnt restarting anymore
prolly a heavy loop/an event listener which was heavy for the ram
if you're using ffmpeg you can instruct it to reconnect, or you can buffer realtime (which is complicated)
@earnest phoenix

or just tell ffmpeg to recconect
which seems super straightforward
also, just did a test with process.exit(1)
and pm2 will restart programs still using it, for anyone who was wondering.
Sad
@earnest phoenix
or use lavalink mmLol
not much difference
probably is when dealing with a lot of streams 🤔
lavalink is good enough
however performance sucks ass
glitch can't handle lavalink
too heavy for it
glitch wont handle ports
why would you make case sensitive commands anyways
command.toLowerCase()
const { MessageEmbed } = require("discord.js")
module.exports = {
name: "help",
usage: "Introduction",
description: "Command Info",
alias: [''],
category: "help",
run: (client, message, args) => {
let helpEmbed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(" ")
.setTitle("ABOUT THE BOT")
.addField("PREFIX", "**tr!**")
.addField("DEVELOPER AND OWNER", "@SA〢Thunderᴬᴱ#0007")
.addField("HELPFUN", "**Sends info about Fun Commands**")
.addField("HELPIMAGE", "**Sends info about Image Commands**")
.addField("HELPSPECIAL", "**Sends info about Special Commands**")
.addField("HELPMODERATION", "**Sends info about Moderation Commands**")
.setFooter(`Requested by ${message.author.username}`)
message.channel.send(helpEmbed)
}
}```
I just created a setprefix command but it doesn't run when i type the command
damn that sucks
const Discord = require('discord.js')
const db = require("quick.db")
module.exports = {
name: 'setprefix',
description: "This is a setprefix command",
async execute(message, args) {
let pref = db.get(`prefix.${message.guild.id}`)
let prefix;
if (!pref) {
prefix = "h!"
} else {
prefix = pref;
}
if (message.content.startsWith(prefix + "prefix")) {
if (!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send("You don't have the permission to do so.")
let data = db.get(`prefix.${message.guild.id}`)
if (message.flags[0] === 'default') {
await db.delete(`prefix.${message.guild.id}`)
return message.channel.send("The server prefix has been changed to a defult one")
}
let symbol = args.join(" ")
if (!symbol) return message.channel.send("Please enter the prefix you want to change")
db.set(`prefix.${message.guild.id}`, symbol)
return message.channel.send(`The server prefix has been changed to **${symbol}**`)
}
}
}
Here's the code ^
debug it
Hmm idk how to do it ;-;
try catch the command and log at every if to see if it's passing, you can also log at places which you think might be problematic
if you have an IDE that supports breakpoints, use breakpoints
okay
i made a
code
but it sends 2 message
if matches
at a time
what should i do
:/
Hello, I have a music bot, and i want to make an option to play a playlist from spotify, is there an option for that? (discord.js)
afaik, Spotify doesn't provide a public API for playing music.
you could fetch the playlist from spotify, but not play it from spotify
so an api who can take the spotify playlist and make it "stream" to play it in discord.js ?
all bots resolve the titles and search using youtube
well, most, probably
well someone who is using browser discord can help me?
i can swap to browser
oh thanks
look, i need know if you enter this link (https://discord.com/channels/@me/516688206020739243) you enter my dm
.-.
dm channel ids are not the same as user ids
each user has their own unique dm channel id with a user they've dm'd
^
🐒
How do I make it so my bot cannot ping everyone with a play command? I have this code:
@commands.bot_has_guild_permissions(mention_everyone=False)```
response.replace("@", "\u200b@")
Ok
hey guys i need help whit search for music bot yt-search:
const yts = require("yt-search");
// Searches YouTube with the message content (this joins the arguments
// together because songs can have spaces)
const {videos} = await yts(args.slice(1).join(" "));
if (!videos.length) return message.channel.send("No songs were found!");
const song = {
title: videos[0].title,
url: videos[0].url
};
// rest of code...
If you want to support both URLs and searching, you can test if the first argument is a valid URL using ytdl.validateURL:
let song;
if (ytdl.validateURL(args[1])) {
const songInfo = await ytdl.getInfo(args[1]);
song = {
title: songInfo.title,
url: songInfo.video_url
};
} else {
const {videos} = await yts(args.slice(1).join(" "));
if (!videos.length) return message.channel.send("No songs were found!");
song = {
title: videos[0].title,
url: videos[0].url
};
}
// rest of code...
TIP: use ``` for code blocks to make your message much less annoying
ok
the best tip is putting code in hastebin
Do you understand what it does?
use yt seacrh to search song
I'm gonna tell you, it's erroring because there is uncommented text.
i got from there
@misty sigil our weekly usage report
ohh
weekly usage
nice
35 mb ram gives itself more
you probably shouldnt copy paste code like that
ok
what the hell
ok
let channel = message.channel || message.mentions.channels.first()
let channelid = channel.id;```
does js message.mentions.channels.first() returns channel id itself?
O
I need the code for ban of java 12 pls can anyone help me all the commands are ready leaving this one
I need the code for ban of java 12 pls can anyone help me all the commands are ready leaving this one
@balmy ether
someone can help me p.l.s
Can't do much without your full code
Nah i ain't helping, post it here so others can help
Okay
I'm just pointing out that posting your code can give insights
someone can help me p.l.s
@frigid rivet I need more from your query
sqlite3.OperationalError: no such table: levels @faint prism
client.on("message", message=>{
if (message.content === '!channelset autoreact ${channel.ID}')
let channel = message.channel || message.mentions.channels.first()
let channelid = channel.id;
console.log(message.channel.id)
})```
Error
```SyntaxError: Lexical declaration cannot appear in a single-statement context

please use a command handler
bruh
why are you using channel before defining it
no wait
ok, so, you'd need to parse args
i sent wrong code
but channel.ID doesn't exist either lmao
idk what the fuck did i copied
whose ugly code is that
wait
lemme get my code
lol
that is totally not your code
Yes i use cmd handler
send good code plz
e
const Discord = require("discord.js")
module.exports = {
name: 'channelset',
description: "Shit",
async execute(message, args){
let channel = message.channel || message.mentions.channels.first()
let channelid = channel.ID;
console.log(channelid)
}}```
i will save it in db
once basic code works
what's youe error? which line?
wait
id on d.js i guess
prioritize message.mentions.channels.first() first over message.channel
its id on d.js
yeah it is
yes it is
Make sure to adhere to your language's naming convention
ok
how to make it so that after clicking on the reaction it is deleted?
code: https://hasteb.in/ohiyubir.js
add message.delete()?
🤔
someone posted best video in #memes-and-media
awaitReactions
yeah, awaitReactions seems better in this case but createReactionCollector also works
client.on("message", message=>{
if (message.content === '!channelset autoreact ${channel.ID}')
let channel = message.channel || message.mentions.channels.first()
let channelid = channel.id;
console.log(message.channel.id)
})```
Error
```SyntaxError: Lexical declaration cannot appear in a single-statement context
@delicate shore its because ur declaring after the one line if
its basically
if (message.content === '!channelset autoreact ${channel.ID}') let channel = message.channel || message.mentions.channels.first()```
yea but im just telling u
(node:9156) UnhandledPromiseRejectionWarning: Error: FFMPEG not found
i download it and its show me again this shit
then download it properly
you have link to see how to download properly
(`Welcome to WinterfallMC Discord ${member}`) this is outputting <@number> but no ping?
@royal portal
I am so fuking done
anyone help?
can you give me pls /
anyone help?
@cosmic robin show code
Someone unbooosted my server i lost a level and now all emotes i used in my bot are messed up
fuck
i sent up xixi
yeah but is it
const Embed = new Discord.MessageEmbed()
.setColor(0xe44f28)
.setTitle(`Welcome to WinterfallMC Discord ${member}`)
.setDescription('Hope you enjoy your stay, feel free to look around and ask any questions!')
.setFooter('Discord Bot Created by Phil#0005')
client.channels.cache.get('736322934510977109').send(Embed);``` heres all of it
u can't ping in the title
you can
its just doesnt ping the user
client.on('guildMemberAdd', member => {
const Embed = new Discord.MessageEmbed()
.setColor(0xe44f28)
.setTitle(`Welcome to WinterfallMC Discord, ${member.user.username}.`)
.setDescription('Hope you enjoy your stay, feel free to look around and ask any questions!')
.setFooter('Discord Bot Created by Phil#0005')
client.channels.cache.get('736322934510977109').send(Embed);
}
});
so you can't ping in the title
dont change it to uwu
well it wont give the user a notification
then it doesn't ping
@cosmic robin edited
ty
does it work
let me test
yes
https://jeremy-clarkson.is-inside.me/K8hvIScI.png can't ping in title
-bots
works tysm
i just edited wat was needed not copy and pasted lmao
i just changed member to member.user.username
you cant without attempting to dm them
okey
i just changed member to member.user.username
@cosmic robin how do you rate your burber experience
dm then catch
user.send("hi")
well you'll get an error if you cant
user.send(`hmmmm`)
.catch(msg = `${user.tag} DM is currently closed!`)
.then(msg = "Your message has been sent!")
not working
it keep sending your message has been sent
that's not how then and catch work
lol not
keep getting this error and these are my dependencies
"botkit-discord": "^0.1.3",
"discord.js": "^12.3.1",
"express": "^4.17.1",
"ffmpeg": "0.0.4",
"ytdl-core": "^3.2.1"
let msg;




