#development
1 messages ยท Page 1017 of 1
message.guild.fetchBans().then(unban=> {
message.guild.members.unban(args[1]);
});
``` does this work?
yes and no
if bans are zero
No
it would work but not what you want
if will be fucked
๐คฃ
message.guild.fetchBans(),then(bans=> {
if(bans.size == 0) return
let bUser = bans.find(b => b.user.id == userID)
if(!bUser) return
message.guild.unban(bUser)
})```
uhmm
bans == 0 return middle finger
my suggestion, dont use code unless you know what it is doing
thats why all of my code is simple

I just realized I've never done moderation commands before
ok
so are leveling bots
hmm
will this send the embed tooo```if(!message.member.hasPermission("BAN_MEMBERS")) {
return message.channel.send(**${message.author.username}**, You do not have perms to unban someone)
}
if(!message.guild.me.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author.username}**, I do not have perms to unban someone`)
}
let userID = args[1]
message.guild.fetchBans(),then(bans=> {
if(bans.size == 0) return
let bUser = bans.find(b => b.user.id == userID)
if(!bUser) return
message.guild.unban(bUser)
})
let embed = new discord.MessageEmbed()
.setTitle("Action : unban")
.setDescription(`:white_check_mark: unbanned `)
.setColor("#ff2050")
.setFooter(`unbanned by ${message.author.tag}`);
message.channel.send(embed)```
try lol
Yeah but leveling can vary from bot to bot
yea
Moderation is always just moderation
school: message.guild.members.ban('632266069146468384', "fun")
lol
earrapes are good
school: if (message.author === "me") {
/kill
}
lmaooo
that code is so wrong
tbh
lol
yea it hurts me to look at
this better lmaoo
const school = true;
if (message.author.id === "277183033344524288" && school) process.exit();```
omg i missed a lot-
if(message.author === 'config.me' && message.environment === 'school') kill(message.author);
one liner
xD
yes
goodnight
I mean
good If(message.author === 'config.me' && message.environment === 'school') kill(message.author);
huh what huh
u didnt gave anything to search
@restive pebble whyit says NAN?
It's got a style to rock ๐
@delicate shore dont do parse int
@restive pebble oh
@restive pebble what yiu mena?
mean*
btw
await message is {} or ()?
()
@chrome pollen no need to spam it across channels
okay sorry @here
and this is #development
https://www.w3schools.com/jsref/jsref_parseint.asp
@restive pebble so they are gonna teach me ?
how can I randomize embed color?
use RANDOM
const randomColor = Math.floor(Math.random() * 16777215).toString(16);
message.guild.fetchBans().then(bans=> {
if(bans.size == 0) return
let bUser = bans.find(b => b.user.id == userID)
if(!bUser) return
message.guild.unban(bUser)
})``` no error, doesnt unbarn
ยฏ_(ใ)_/ยฏ
const randomColor = Math.floor(Math.random() * 16777215).toString(16);
@earnest phoenix smart I wouldve never thought bout that xD
๐
Am very new to bot making, and documentation is too complex
Where should I get help
Ask here if you really dont know
Ok thanks ๐
const randomColor = Math.floor(Math.random() * 16777215).toString(16);
@earnest phoenix
?
why 16777215 ?
Because stack overflow
ok tnx
xD
anyone ever had any luck having multiple "createReactionCollector" collect events running in the same channel?
I find that when I instantiate a new reaction collector, it stops the collect event on the previous running one
How can i make a log file?
well, @spare mirage u gave me a gr8 idea, XD
var colors = [color1, color2, color3, color4, color5];
ahh lemme fix
ok,wait let me try again
How can i make a log file wih the text from the console?
function randomcolor() {
var colors = [color1, color2, color3, color4, color5];
return colors[Math.floor(Math.random()*colors.length)];```
@balmy nimbus
then,
and then
oops
WHat?
if u don't want it from a list u can just do setColor("RANDOM")
no probs
yes but he wants 5 randomized colros
How to play song????
well, that didn't work ๐ถ
hence why I prefixed my message with "if u don't want it from a list"
wait 1 min
okok
How can i make a log file wih the text from the console?
?
yes
function randomcolor() {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return rand[Math.floor(Math.random()*rand.length)];
}
const embedmsg = new Discord.MessageEmbed()
.setDescription(desc)
.setColor(colors)
change rand to color
here
randomcolor*
ok
@earnest phoenix whys that?
@low phoenix if u want to log errors try catch because without catch error goes in the console then u can do fs writefile function to a destination file
const color = await randomcolor()
@earnest phoenix
Embed color?
nop
@balmy nimbus just give the code you have now and ill fix
hatsebin
at WebSocketManager.connect (/rbd/pnpm-volume/73ea2317-b08a-408a-8e30-d1c38dc04706/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/websocket/WebSocketManager.js:135:26)
at Client.login (/rbd/pnpm-volume/73ea2317-b08a-408a-8e30-d1c38dc04706/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/Client.js:221:21)
at async init (/app/src/index.js:42:3)
(node:2165) 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(). (rejection id: 1)
(node:2165) [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.```
**What does this mean?**
but easier
@spare mirage ๐
(node:2165) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (/rbd/pnpm-volume/73ea2317-b08a-408a-8e30-d1c38dc04706/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/websocket/WebSocketManager.js:135:26)
at Client.login (/rbd/pnpm-volume/73ea2317-b08a-408a-8e30-d1c38dc04706/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/Client.js:221:21)
at async init (/app/src/index.js:42:3)
(node:2165) 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(). (rejection id: 1)
(node:2165) [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.```
**What does this mean???***
There is a valid token.
function randomcolor() {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return randomcolor[Math.floor(Math.random()*randomcolor.length)];
}```
Stop spamming.
No lol
but
Lol
There is a valid token.
panda that ur pfp annoys
Now go and regenerate lol
just use "RANDOM"

works in discord.js
Bsut he wants only those 3 colors
I KNOW!!!!
Yea
:O
suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuup its meeeeeeeeeeee
ic
but i want 4 certain colors
function randomcolor() {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return randomcolor[Math.floor(Math.random()*randomcolor.length)];
}```
@balmy nimbus
ya

ok lets try again .................................
how do i loop music? i put a loop = false into my queue construct and here is the toggle mechanism but how do i go about actually looping the music?
case 'loop':
if (!msg.member.voice.channel) {
return msg.channel.send('You must be in a voice channel to loop music')
} else if (!serverQueue) {
return msg.channel.send("There is nothing playing here");
} else {
if (serverQueue.loop == false) {
msg.reply('i started looping the music')
!serverQueue.loop
} else if (serverQueue.loop == true) {
msg.reply('i stopped the music loop')
!serverQueue.loop
}
break;
Don't push
@restive pebble epiccccccccccc ty
Well Lemme see my code
how do i toggle that ๐๏ธ
nop
is not defined
at Client.<anonymous> (C:\Users\KabboSk\Desktop\ARD\main.js:43:21)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\KabboSk\Desktop\ARD\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\KabboSk\Desktop\ARD\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\KabboSk\Desktop\ARD\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\KabboSk\Desktop\ARD\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (C:\Users\KabboSk\Desktop\ARD\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (C:\Users\KabboSk\Desktop\ARD\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\KabboSk\Desktop\ARD\node_modules\ws\lib\websocket.js:800:20)
(node:3244) 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:3244) [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.````
bruh @balmy nimbus
something wrong with ur function
If loops is true don't shift
๐ถ
function randomcolor() {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return randomcolor[Math.floor(Math.random()*rand.length)];
}
var color = [];
maybe
no rand.length
did someone got a idea how to efficent get proper time values from command arugments like 1d 2w or 1m?
ik but how do i toggle in real time?
Brain
ahh
When song ends
no thats not the prob wither
function randomcolor() {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return randomcolor[Math.floor(Math.random()*rand.length)];
}
@spare mirage just use setColour(RANDOM)
lul
i would just make some stupid spageti code that will work but i want to see if i can find something more efficent
and dont spoonfeed
did someone got a idea how to efficent get proper time values from command arugments like 1d 2w or 1m?
@lusty quest idk check if it ends with m or w and then multiply?
insted of randomolor ?
yea just got the same idea
@lusty quest if you're using discord js you could check out ms https://github.com/vercel/ms
function randomcolor(colors) {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return randomcolor[Math.floor(Math.random()*rand.length)];
}
what is the problem in this code it says error applyText not defined
wtf is applyText
@pure lion that didn't work
oof
Canvas
also, yeah font is a string
Register font lol
what are u trying @wheat hornet
google is destroyed by my search but no luck ๐
@restive pebble ok
btw you realise
Resolve from path
``
serverQueue.songs.push(serverQueue.songs.shift())
@shitdev

๐
define color
what if i remove function randomcolor() {
no
no
its not gonna work
that will break
pop
btw youre a potato
๐
why dont you define the array outside the function and pass it in?
what are the biggest security risks with an eval command? obviously everything that has to do with client.token and maybe role assignment but what else
its almost as if it :gasp: worked for mee?????
Directly use inside setColor
what are the biggest security risks with an eval command? obviously everything that has to do with client.token and maybe role assignment but what else
@sonic ivy anybody can access ur token and other stuffs
so um
And even process.exit
make it dev only
And if hosted on ur computer could be a huge risk to ur data
And even process.exit
this is a fun one if someones bot has an open eval
@restive pebble could do
I think the biggest security ... is
@sonic ivy the ability to use exec
in linux u can delete the bot files using eval I think
fs can do
but ye how do i toggle push?
.on finish
when the song ends
i pass in serverQueue and check if loop is true or not?
Yea
@restive pebble it worked thx
message.guild.fetchBans().then(bans=> {
if(bans.size == 0) return
let bUser = bans.find(b => b.user.id == userID)
if(!bUser) return
message.guild.unban(bUser)
})``` why does this nobt unban
I saw that
lol
I did
ok ill see s
just doesnt unban
does it says not a function?
fetchBans() is still a function in v12?
yes
no errors
ou
ok
just doesnt unban
lol
did you provide an ID or a mention
Guild.unban is not a function
<@! ID >
members.unban yeah?
Guild.members.unban
let user = message.guild.members.mention.first()
wait what
@finite bough wot?
wait
You can
that doesn't even exist tho... The function you showed
LMFAO
but after some time you can't
You can't
It's impossible to mention banned members
actually
You can tag banned members for some time if its cached, i guess
@earnest phoenix its not
?
u can
#development message yeah
Yep
it will just show invalid user coz it's not cached
Cause i have that in my bot
Anyway, the best thing to do is to get by ID i guess
I use username
let userID = args[1]
message.guild.fetchBans().then(bans=> {
if(bans.size == 0) return
let bUser = bans.find(b => b.user.id == userID)
if(!bUser) return
message.guild.members.unban(bUser)
tag
yh
Cuz they'll be uncached anyway
or id
@spare mirage that should work
imma try
try using the id@spare mirage
also unban takes an ID
I use ID
it takes anything
nana
wait bUser is a ban object
Lemme check
^
add .user
well
it's a member
??????????
so a user
what
message.guild.members.unban(bUser.user)
?
yeah that works
and I enter the id?
yes
ye
It takes 3 things
ID / user object and guild member object
yes
it's called userresolvable
ok
basically anything that can be turned to a user
poor lilpeep
Show your current code again
const discord = require("discord.js");
module.exports = {
name: "unban",
category: "moderation",
description: "Welcome Back!",
usage: "unban <@user> <reason>",
execute(Discord, bot, message, args) {
if(!message.member.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author.username}**, You do not have perms to unban someone`)
}
if(!message.guild.me.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author.username}**, I do not have perms to unban someone`)
}
let userID = args[1]
message.guild.fetchBans().then(bans=> {
if(bans.size == 0) return
let bUser = bans.find(b => b.user.id == userID)
if(!bUser) return
message.guild.members.unban(bUser.user)
})
let embed = new discord.MessageEmbed()
.setTitle("Action : unban")
.setDescription(`:white_check_mark: unbanned `)
.setColor("#ff2050")
.setFooter(`unbanned by ${message.author.tag}`);
message.channel.send(embed)
}
}```
it sends the embed
just doesnt unban
poor lilpeep
@pale vessel nah he deserves it
he's already dead
Oh boi
anyway lol
That's why python is easier
sure!
by the way, that's a mention, not an ID ignore this
args[1] doesn't exist
Hey guys
arrays start from 0
oh ye lol
Can anyone help me with command handler
Yea array start from 0 as default index
Like how can I shift my code into command handler
Because due to all codes in one
File
const args = message.content.slice(PREFIX.length).split(/ +/);
It's getting 2k ping
thats not because its all in 1 file
@spare mirage
I host it on glitch
thats just ur connection
@spare mirage
100 mb/s
thats glitch's connection
thats glitch's connection
@spare mirage
Oh but people suggested to keep codes in different files
Intact glitch said it themselves
it wont matter if u put it in 1 2 3 4 5 or 10000 files
Oh
Are u sure ?
@spare mirage idk why when I refresh the code the ping reached 5000+ but after few minutes it ones back to 50
Maybe because it's connecting to all getaways ?
Send code
@delicate shore I wouldnt really know tbh I dont use glitch
you probably had two instances running
wich means?
Bruh

you probably had two instances running
this
im not leaking code to u xD
Lol
let embed = new discord.MessageEmbed()
.setTitle("Action : unban")
.setDescription(`:white_check_mark: unbanned `)
.setColor("#ff2050")
.setFooter(`unbanned by ${message.author.tag}`);
message.channel.send(embed)
console.log(args)
```
I was all time here
here is my embed
can somebody help me why do i get Cannot read property 'length' of undefined in
let question = message.content.slice(client.prefix.length+6)
if(!question) {
message.reply("You need to ask a question!")
} else {
let responses = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes โ definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to yes",
"Donโt count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful",
"Reply hazy, try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again"
]
let response = responses[Math.floor(Math.random()*(responses.length))]
let embed = new MessageEmbed()
.addField(response)
message.reply(embed)
}
}
please?
You probably running 2 instance or your bot is responding to itself @spare mirage
ok
@fresh hatch which line?
let question = message.content.slice(client.prefix.length+6
and
let response = responses[Math.floor(Math.random()*(responses.length))]
client.prefix is undefined probably
eh
hi
Hey
8ball lol
lol
justii u were to go in school right?
yea
@fresh hatch if you just defined your prefix as prefix you can do
prefix.length```
But if you want to do it `client.prefix.length` way define prefix as
let client.prefix = "YOUR PREFIX";
then use
client.prefix.length```
let PREFIX works good enough
am I dumb
he cannot acess anywhere
mannn I need sleep
then use prefix.length
lol
Why an array tho lol
Bruh
What
Wtf is he doing
He's beginning to believe

Ahh this is where boing hangs xD
@fresh hatch just try
let prefix = "-";
assign it to client.prefix
then why are you defining it again
or u have require everywhere lol
and i suggest to use args
imagine slicing in every command
Just use prefix.length and remove the definings of the prefix anywhere on top
why would u use bot.js
u know how to require from js files?
Wtf 

Hmm...
no
else if(message.content.startsWith(PREFIX + "kick")) {
bot.commands.get('kick').execute(Discord, bot, message, args);
} I didnt have this



Maybe he forked discord.js and added prefix as a function @restive pebble
will it be funny if it said "Message.author You just kicked his ass"



@restive pebble prefix is in the settings.js file => he imports it from discord.js
Logic is Infinite here


.on("finish", () => {
if (serverQueue.loop == false) {
serverQueue.songs.shift();
play(guild, serverQueue.songs[0]);
} else if (serverQueue.loop == true) {
play(guild, serverQueue.songs[0]);
}
})
iz not werk
boing
hep me
pleieieieeieieije
@restive pebble
===
@pure lion use !
Two instances
Where u hosting
restarting the bot works
ptero
for me
And check it two instances are running
it isnt
when I use help command sends 1 time
Restart is best fix
^
hey
Can't restart I need uptime
oh
how to see your uptime time ? @spare mirage
process uptime
process has it
@finite bough glitch.com
process uptime
anyone know some fun fun commands xD
my way is to get process uptime
then turn it into min hours etc
.getUTChours()
or smthing like that
moment-duration-format
anyone know some fun fun commands xD
Hi, does anyone know why i cant use this let outside of the callback?
It just returns undefined
And yes, the res.rows does return the prefix
ยฏ\_(ใ)_/ยฏ
the callback runs after the console.log
Hi, does anyone know why i cant use this let outside of the callback?
@earnest phoenix because yourconsole.log(prefix)is executed before the callback
the callback is everything that happens after the query
how do I generate a random number from 1-100?
Where would i use/define my prefix then?
how do I generate a random number from 1-100?
@spare mirage https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
@earnest phoenix either use async instead of callback or put all your code inside the callback
So i would do
const prefixGet = await client.query(getPrefixQuery);
and then i got prefixGet.res and prefixGet.err?
not really
prefixGet is then prefixGet.res
try {
const prefixGet = await client.query(getPrefixQuery);
// `prefixGet` is now `prefixGet.res`
} catch (err) {
// `err` is now `prefixGet.err`
}
that should work
I dont have to make a function in a module.exports = { right? what do I use then for a function
what do you mean? 
Ill show
const Discord = require('discord.js')
module.exports = {
name: 'stats',
description: "this is a stats command!",
execute(Discord, bot, message, args){
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
}
}
``` this @weary anchor
Im making a function
in another function
will it still work
that's ok. but then you can only access the child function within the parent function.
like, you can only use getRandomIntInclusive from within execute
np
@weary anchor Worked! Thank you!
np :)
this is a problem
if(message.content.startsWith(PREFIX + "ping")) {
bot.commands.get('ping').execute(Discord, bot, message, args);
}else if(message.content.startsWith(PREFIX + "image")) {
bot.commands.get('image').execute(Discord, bot, message, args);
}else if(message.content.startsWith(PREFIX + "stats")) {
bot.commands.get('stats').execute(Discord, bot, message, args);
}else if(message.content.startsWith(PREFIX + "purge")) {
bot.commands.get('purge').execute(Discord, bot, message, args);
}else if(message.content.startsWith(PREFIX + "ban")) {
bot.commands.get('ban').execute(Discord, bot, message, args);
}else if(message.content.startsWith(PREFIX + "unban")) {
bot.commands.get('unban').execute(Discord, bot, message, args);
}else if(message.content.startsWith(PREFIX + "kick")) {
bot.commands.get('kick').execute(Discord, bot, message, args);
}else if(message.content.startsWith(PREFIX + "say")) {
bot.commands.get('say').execute(Discord, bot, message, args);
}else if(message.content.startsWith(PREFIX + "bananasize")) {
bot.commands.get('bananasize').execute(Discord, bot, message, args);
}```
how do I fix this?
Hey, does anyone know how i can get the heartbeat ping on my bot?
module.exports = {
name: 'size',
description: "this is a fun command!",
execute(Discord, bot, message, args){
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
message.channel.send(getRandomIntInclusive)
}
}
``` why am I getting
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
``` as response?
its a function
You should do it like getRandomIntInclusive(1233,2939) (example)
Hey, does anyone know how i can get the heartbeat ping on my bot?
yes
:/
.addField(`how big is ur banana?`, `\n${message.author.tag}s banana is ${getRandomIntInclusive(1, 100)} inches long`, true) how do I make author like @spare mirage
and not justii#3473\
ping?
Just message.author
no that gave the id
what do you mean?
I see..
ok
man I love this command
hey
does anyone know how to make my discord bot
play music
form spotify
because i usally get rate limited
from youtube
wdym rate limited?
Bruh
bruh
Lavalink
to docs
just search google :3
https://www.npmjs.com/package/spotify use this to get link
and lavalink is py right ?
no lol
ok
no lol
hi auric
hi boeing
does anyone know how i can get the heartbeat ping on my bot?
which library
discordjs
v12?
ye
client.ws.ping
const broadcastdis = Discord.BroadcastDispatcher(); is that right?
i tried that before and it said something like ping is not defined
@low phoenix client.voice.createBroadcast()
@delicate shore yes, lavalink can be used in python
okay, and how can i pause the music? @quartz kindle
dispatcher.pause lol
i tried that before and it said something like ping is not defined
@white drum then you aren't in v11 are you have client defined as bot
@white drum then you aren't in v11 are you have client defined as bot
@earnest phoenix im in v12 but i use bot e.g. bot.on etc
then use bot.ws.ping
then it's bot.ws.ping
ill try
self-explanatory
do i need Math.round?
no
lol
k
speaking of which why is my ws ping so damn high
oof
is discord being bad again
lul
ok
bruh
const Discord = require ("discord.js");
const bot = new Discord.Client ();
module.exports = {
name: 'ping',
description: 'Checks the bot\'s ping',
usage: '!ping',
args: false,
async execute(message, args) {
try {
const pingMsg = await message.channel.send('Pinging...');
return pingMsg.edit(`
Pong! **${
(pingMsg.editedTimestamp || pingMsg.createdTimestamp) - (message.editedTimestamp || message.createdTimestamp)
}ms.** | **${
bot.ws.ping
}ms.**
`);
}catch(e){
console.log(e.stack);
}
}
}```
lol
wot
dude...
ms
what the fuck
lol
.....

i have a command handler
use normal client
i have a command handler
@white drum define it in params
unless you want to run multiple bots
read lol
you can easily get your existing client, all discordjs structures have a .client property
so you can do message.client for example
and that'll give you your existing bot client
ahuh..
at this point you might as well "learn basic js"
true
you dont have to judge me for it
my god
forgive us lol
because people see that you can reimport libraries by using require again, so they think that you can do the same by creating a new bot client
its a honest mistake that many people do at the beginning, no big deal
you dont have to judge me for it
@white drum you've got your help now don't complain about it
also one most people go through lol
"what if i close my command line, does it still work? ahh nope"
are you doing weird math on it?
lmao weird math ๐
Is shit Dev here ?
who? lol
lol
imagine getting help from a shit dev
Check dms if you can shit Dev
lol
Lol

lol
Should I call him
shit dev lmfao
@delicate shore btw why you no make new yt api?
lol what
use cheerio lol
Google fucking realises

use cheerio lol
@restive pebble ?
cheerio lol
npm i cheerio
search it up
their npm page always contains docs or a link to docs
there since you can't search it yourself
it isn't
the link was bad
here just forgot the rest of the domain

lmao
lel
Pls
learn DOM
ShitDev com online
and JQUERY
that for html
to use cheerio
Ok
ยฏ_(ใ)_/ยฏ
I don't wanna use cheerio
ok
ok sucks to be u
stay with rate limits
I am gonna use. Lavalinn
Not for me

tough times
first world problems
nope
oh
so he fucking lost BloodBot premium
@earnest phoenix
What is that
they do have lavalink related npm packages
send me cherio again pls lol
cheerio
ok
lavalink is very difficult
i changed my mind
code
oh wait
lol
why is noone online?
hello?
noice
https://medium.com/free-code-camp/how-to-create-a-music-bot-using-discord-js-4436f5f3f0f8
lol
hey
@delicate shore just use ytdl
in my life i was not able to find lavalink
lol
and u found code
ok
const config = require("./config.json");
const fetch = require("node-fetch");
const { inspect } = require("util");
const { URLSearchParams } = require("url");
const { Client } = require("discord.js");
const { PlayerManager, Player } = require("../dist/index.js");
class MusicClient extends Client {
constructor(...args) {
super(...args);
this.player = null;
this.on("ready", () => {
this.player = new PlayerManager(this, config.nodes, {
user: this.user.id,
shards: 1,
Player: ExamplePlayer
});
this.player.on("ready", node => console.log(`${node.host}: Is ready`));
this.player.on("disconnect", (node, event) => console.log(`${node.host}: Disconnected with code ${event.code} and reason ${event.reason || "No Reason Specified"}`));
this.player.on("raw", (node, data) => console.log(node.host, data));
this.player.on("error", (node, error) => console.error(node.host, error));
console.log("Bot is online!");
})
.on("error", console.error)
.on("warn", console.warn);
}
}
const client = new MusicClient();
client.on("message", async msg => {
if (msg.author.bot || !msg.guild) return;
if (!msg.content.startsWith(config.prefix)) return;
const args = msg.content
.slice(config.prefix.length)
.trim()
.split(/ +/g);
const command = args.shift().toLowerCase();
if (command === "play") {
if (!msg.member || !msg.member.voice.channel) return msg.reply("You must be in a voice channel for this command.");
this is starting code
but
see
like
how it's getting my prefix
and it said if command


