#development

1 messages ยท Page 1017 of 1

pale vessel
#

i give up

spare mirage
#

oh lol

#

did I just unban everyone

#

lmaooo

earnest phoenix
#

Server nuker

spare mirage
#
message.guild.fetchBans().then(unban=> {
        message.guild.members.unban(args[1]);
      });
``` does this work?
crimson vapor
#

yes and no

restive pebble
#

if bans are zero

earnest phoenix
#

No

crimson vapor
#

it would work but not what you want

restive pebble
#

if will be fucked

earnest phoenix
#

๐Ÿคฃ

spare mirage
#

buck

#

fuck

#

just kill me reeeeeeeeeeeeeeeeeeeeeeeeeee

crimson vapor
#
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)
})```
spare mirage
#

uhmm

restive pebble
#

bans == 0 return middle finger

crimson vapor
#

my suggestion, dont use code unless you know what it is doing

#

thats why all of my code is simple

restive pebble
strange trout
#

I just realized I've never done moderation commands before

restive pebble
#

ok

crimson vapor
#

try it

#

its fun

restive pebble
#

i dont like mod commands

#

its common

#

lol

crimson vapor
#

so are leveling bots

restive pebble
#

hmm

spare mirage
#

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)```
restive pebble
#

try lol

strange trout
#

Yeah but leveling can vary from bot to bot

crimson vapor
#

yea

restive pebble
#

yes it should send

#

embed

crimson vapor
#

everyone has different twists on it

#

like mine was a little simplistic

strange trout
#

Moderation is always just moderation

spare mirage
#

gtg to school

#

byeee

crimson vapor
#

school: message.guild.members.ban('632266069146468384', "fun")

spare mirage
#

lol

strange trout
#

My bot does a couple of stuff

#

And I'd say it does it all very good

restive pebble
#

earrapes are good

spare mirage
#

school: if (message.author === "me") {
/kill
}

#

lmaooo

#

that code is so wrong

#

tbh

#

lol

crimson vapor
#

yea it hurts me to look at

spare mirage
#

this better lmaoo

pale vessel
#
const school = true;

if (message.author.id === "277183033344524288" && school) process.exit();```
rotund willow
#

omg i missed a lot-

spare mirage
#

haha

#

thats my bio

opal plank
#
if(message.author === 'config.me' && message.environment === 'school') kill(message.author);
#

one liner

spare mirage
#

xD

#

yes

#

goodnight

#

I mean

#

good If(message.author === 'config.me' && message.environment === 'school') kill(message.author);

rotund willow
#

huh what huh

delicate shore
#

this is what logs say now

restive pebble
#

u didnt gave anything to search

delicate shore
ancient falcon
#

It's got a style to rock ๐Ÿ˜Ž

restive pebble
#

@delicate shore dont do parse int

#

lol

delicate shore
#

@delicate shore dont do parse int
@restive pebble oh

#

@restive pebble what yiu mena?

#

mean*

#

btw

#

await message is {} or ()?

restive pebble
#

()

delicate shore
#

ok

#

@restive pebble how to crrect that Nan

restive pebble
chrome pollen
#

@everyone

#

i wish you a great day

sinful belfry
#

@chrome pollen no need to spam it across channels

chrome pollen
#

okay sorry @here

sinful belfry
delicate shore
restive pebble
#

remove parseInt

#

since ur sending int

earnest phoenix
#

how does one unassign an event in djs

#

say the message event

balmy nimbus
#

how can I randomize embed color?

pale vessel
#

use RANDOM

balmy nimbus
#

RANDOM ๐Ÿ”

#

didn't randomized tho

earnest phoenix
#

const randomColor = Math.floor(Math.random() * 16777215).toString(16);

spare mirage
#
      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

earnest phoenix
#

๐Ÿ™‚

ember locust
#

Am very new to bot making, and documentation is too complex

#

Where should I get help

spare mirage
#

Ask here if you really dont know

ember locust
#

Ok thanks ๐Ÿ˜‡

balmy nimbus
#

const randomColor = Math.floor(Math.random() * 16777215).toString(16);
@earnest phoenix

earnest phoenix
#

?

balmy nimbus
#

why 16777215 ?

earnest phoenix
#

Because stack overflow

balmy nimbus
#

ok tnx

spare mirage
#

xD

balmy nimbus
#

ok, if i want to randomize it in 5 colors

#

how to do that?

restive shell
#

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

low phoenix
#

How can i make a log file?

spare mirage
#

@balmy nimbus same as u make 8ball

#

xD

#

but 5ball

balmy nimbus
#

well, @spare mirage u gave me a gr8 idea, XD

spare mirage
#

var colors = [color1, color2, color3, color4, color5];

balmy nimbus
#

i tried that

#

but, doesn't work

spare mirage
#

ahh lemme fix

balmy nimbus
#

ok,wait let me try again

low phoenix
#

How can i make a log file wih the text from the console?

spare mirage
#
function randomcolor() {
  var colors = [color1, color2, color3, color4, color5];
  return colors[Math.floor(Math.random()*colors.length)];```
#

@balmy nimbus

balmy nimbus
#

then,

spare mirage
#

and then

balmy nimbus
#

colors[rand]

#

?

#

@spare mirage

spare mirage
#

oops

balmy nimbus
#

WHat?

spare mirage
#

fixed

#

.setColor(colors)

#

and I forgot how to type colors

smoky spire
#

if u don't want it from a list u can just do setColor("RANDOM")

balmy nimbus
#

no probs

spare mirage
#

yes but he wants 5 randomized colros

reef lava
#

How to play song????

balmy nimbus
#

well, that didn't work ๐Ÿ˜ถ

smoky spire
#

hence why I prefixed my message with "if u don't want it from a list"

spare mirage
#

code?

#

@balmy nimbus

balmy nimbus
#

wait 1 min

spare mirage
#

okok

balmy nimbus
#

UnhandledPromiseRejectionWarning: ReferenceError: color is not defined

#

this issue

low phoenix
#

How can i make a log file wih the text from the console?
?

spare mirage
#

you have to close the function

#

@balmy nimbus

balmy nimbus
#

yes

spare mirage
#

^

#

give code

restive pebble
#

?
@low phoenix wut

#

oh logging

balmy nimbus
#

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)

spare mirage
#

change rand to color

balmy nimbus
#

here

spare mirage
#

randomcolor*

balmy nimbus
#

ok

spare mirage
#

@earnest phoenix whys that?

restive pebble
#

@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

spare mirage
#

const color = await randomcolor()
@earnest phoenix

restive pebble
#

Embed color?

balmy nimbus
#

nop

restive pebble
#

Ok

balmy nimbus
#

didn't work

spare mirage
#

@balmy nimbus just give the code you have now and ill fix

balmy nimbus
#

i am giving the whole main.js

#

๐Ÿ˜‹

spare mirage
#

hatsebin

restive pebble
#

U want to gen random colors?

balmy nimbus
earnest phoenix
#
    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?**
balmy nimbus
#

i removed the token

#

hatsebin
@spare mirage

#

whats that ///

restive pebble
#

Hey

#

Embed have an inbuilt function

#

Lol

spare mirage
#

a site

#

like pastebin

#

but easier

balmy nimbus
#

but easier
@spare mirage ๐Ÿ˜†

earnest phoenix
#
(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???***
restive pebble
#

Lol

#

Token is invalid

#

Lol

#

Lol

#

Lol

earnest phoenix
#

There is a valid token.

spare mirage
#
function randomcolor() {
         var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
         return randomcolor[Math.floor(Math.random()*randomcolor.length)];
         }```
earnest phoenix
#

Stop spamming.

restive pebble
#

No lol

earnest phoenix
#

but

restive pebble
#

Lol

earnest phoenix
#

There is a valid token.

restive pebble
#

U have pasted it in github

spare mirage
#

panda that ur pfp annoys

restive pebble
#

Now go and regenerate lol

pale vessel
#

just use "RANDOM"

restive pebble
pale vessel
#

works in discord.js

restive pebble
#

Bsut he wants only those 3 colors

balmy nimbus
#

I KNOW!!!!

restive pebble
#

Yea

pale vessel
#

:O

pure lion
#

suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuup its meeeeeeeeeeee

pale vessel
#

ic

balmy nimbus
#

but i want 4 certain colors

spare mirage
#

function randomcolor() {
         var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
         return randomcolor[Math.floor(Math.random()*randomcolor.length)];
         }```
#

@balmy nimbus

balmy nimbus
#

ya

spare mirage
#

u had rand

#

it has to be randomcolor

restive pebble
#

rand is cpp

spare mirage
balmy nimbus
#

ok lets try again .................................

pure lion
#

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;
restive pebble
#

Don't push

#

Lol

pure lion
#

Don't push
@restive pebble epiccccccccccc ty

restive pebble
#

Well Lemme see my code

pure lion
#

how do i toggle that ๐Ÿ‘๏ธ

balmy nimbus
#

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.````
spare mirage
#

bruh @balmy nimbus

balmy nimbus
#

same isssue

#

bruh @balmy nimbus
@spare mirage ?

spare mirage
#

something wrong with ur function

restive pebble
#

If loops is true don't shift

balmy nimbus
#

๐Ÿ˜ถ

spare mirage
#

function randomcolor() {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return randomcolor[Math.floor(Math.random()*rand.length)];
}

#

var color = [];
maybe

restive pebble
#

serverQueue.songs.push(serverQueue.songs.shift())

#

This logic

balmy nimbus
#

no rand.length

lusty quest
#

did someone got a idea how to efficent get proper time values from command arugments like 1d 2w or 1m?

pure lion
#

ik but how do i toggle in real time?

restive pebble
#

Brain

spare mirage
#

ahh

restive pebble
#

When song ends

balmy nimbus
#

no thats not the prob wither

pure lion
#

function randomcolor() {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return randomcolor[Math.floor(Math.random()*rand.length)];
}
@spare mirage just use setColour(RANDOM)

#

lul

spare mirage
#

@pure lion

#

HE WANT 4 colors

pure lion
#

a h

#

its simple

lusty quest
#

i would just make some stupid spageti code that will work but i want to see if i can find something more efficent

pure lion
#

and dont spoonfeed

spare mirage
#

mf

#

^

#

thats what a said

pure lion
#

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?

balmy nimbus
#

insted of randomolor ?

lusty quest
#

yea just got the same idea

sonic ivy
#

@lusty quest if you're using discord js you could check out ms https://github.com/vercel/ms

pure lion
#

function randomcolor(colors) {
var colors = ["#00FFFF", "#0BF446", "#32527B", "#FCA500"]
return randomcolor[Math.floor(Math.random()*rand.length)];
}

wheat hornet
pale vessel
#

wtf is applyText

pure lion
#

font is a fontname

#

wtf is applyText
this too

balmy nimbus
#

@pure lion that didn't work

pure lion
#

oof

restive pebble
#

Canvas

pale vessel
#

also, yeah font is a string

restive pebble
#

Register font lol

spare mirage
#

what are u trying @wheat hornet

balmy nimbus
#

google is destroyed by my search but no luck ๐Ÿ˜†

wheat hornet
#

@restive pebble ok

pure lion
#

btw you realise

restive pebble
#

Resolve from path

pure lion
#

nvm i dont wanna spoonfeed

#

like mr aeroplane

restive pebble
#

For what

#

Tell the problem

#

I wont spoonfeed

#

I answered ur question tho

balmy nimbus
restive pebble
#

serverQueue.songs.push(serverQueue.songs.shift())

@shitdev

restive pebble
balmy nimbus
#

๐Ÿ˜†

spare mirage
#

define color

restive pebble
#

Color is not defined

#

Lol

#

function color

#

Lol

finite bough
#

canvas

#

OOF

balmy nimbus
#

what if i remove function randomcolor() {

pure lion
#

no

spare mirage
#

no

pure lion
#

its not gonna work

spare mirage
#

that will break

restive pebble
#

pop

balmy nimbus
#

ya ok

#

but

pure lion
#

btw youre a potato

balmy nimbus
#

๐Ÿ˜‘

pure lion
#

why dont you define the array outside the function and pass it in?

restive pebble
#

Or why making it a function lol

sonic ivy
#

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

pure lion
#

its almost as if it :gasp: worked for mee?????

restive pebble
#

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

pure lion
#

so um

restive pebble
#

And even process.exit

pure lion
#

make it dev only

restive pebble
#

And if hosted on ur computer could be a huge risk to ur data

pure lion
#

And even process.exit
this is a fun one if someones bot has an open eval

spare mirage
#

@restive pebble could do

restive pebble
#

Lol

#

Function lovers lol

pure lion
#

exec cd-

#

cd nudes

sonic ivy
#

it is dev only already but just wanna make sure

#

thanks

finite bough
#

I think the biggest security ... is

pale vessel
#

@sonic ivy the ability to use exec

finite bough
#

in linux u can delete the bot files using eval I think

restive pebble
#

fs can do

pure lion
#

but ye how do i toggle push?

restive pebble
#

.on finish

pure lion
#

not pus

#

oh

restive pebble
#

when the song ends

pure lion
#

i pass in serverQueue and check if loop is true or not?

restive pebble
#

Yea

pure lion
#

ok epic

#

ty

wheat hornet
#

@restive pebble it worked thx

spare mirage
#
      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

finite bough
#

any errors?

spare mirage
#

no

#

it sends the embed

restive pebble
#

ok ill see s

spare mirage
#

just doesnt unban

restive pebble
#

does it says not a function?

finite bough
#

fetchBans() is still a function in v12?

pale vessel
#

yes

spare mirage
#

no errors

finite bough
#

ou

spare mirage
#

no logs

#

nothing

restive pebble
#

ok

spare mirage
#

just doesnt unban

restive pebble
#

lol

pale vessel
#

did you provide an ID or a mention

earnest phoenix
#

Guild.unban is not a function

spare mirage
#

<@! ID >

finite bough
#

lol

#

that's the issue

pale vessel
#

members.unban yeah?

earnest phoenix
#

Guild.members.unban

finite bough
#

let user = message.guild.members.mention.first()

spare mirage
#

wait what

earnest phoenix
#

@finite bough wot?

pale vessel
#

wot, you can mention banned members?

#

after they're banned, yes since they're cached

spare mirage
#

admins can

#

I think

finite bough
#

wait

slate forge
#

You can

earnest phoenix
#

that doesn't even exist tho... The function you showed

finite bough
#

LMFAO

pale vessel
#

but after some time you can't

earnest phoenix
#

You can't

finite bough
#

NO

#

u cant

#

BRAH

earnest phoenix
#

It's impossible to mention banned members

spare mirage
finite bough
#

actually

slate forge
#

You can tag banned members for some time if its cached, i guess

finite bough
#

@earnest phoenix its not

earnest phoenix
#

?

finite bough
#

u can

pale vessel
slate forge
#

Yep

finite bough
#

it will just show invalid user coz it's not cached

slate forge
#

Cause i have that in my bot

earnest phoenix
#

Anyway, the best thing to do is to get by ID i guess

finite bough
#

I use username

spare mirage
#

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)

finite bough
#

tag

slate forge
#

yh

earnest phoenix
#

Cuz they'll be uncached anyway

finite bough
#

or id

earnest phoenix
#

@spare mirage that should work

spare mirage
#

imma try

finite bough
#

try using the id@spare mirage

earnest phoenix
#

also unban takes an ID

spare mirage
#

I use ID

pale vessel
#

it takes anything

earnest phoenix
#

Really

finite bough
#

nana

pale vessel
#

wait bUser is a ban object

earnest phoenix
#

Lemme check

pale vessel
#

so it's bUser.user

#

bUser.user

finite bough
#

^

spare mirage
#

wait

#

so

pale vessel
#

add .user

slate forge
#

well

finite bough
#

it's a member

pale vessel
#

??????????

finite bough
#

so a user

pale vessel
#

what

spare mirage
#

message.guild.members.unban(bUser.user)

finite bough
spare mirage
#

?

pale vessel
#

yeah that works

spare mirage
#

and I enter the id?

finite bough
#

yes

pale vessel
#

ye

earnest phoenix
#

It takes 3 things
ID / user object and guild member object

finite bough
#

yes

pale vessel
#

it's called userresolvable

spare mirage
#

ok

pale vessel
#

basically anything that can be turned to a user

spare mirage
#

no error

#

no log

pale vessel
#

poor lilpeep

earnest phoenix
#

Show your current code again

spare mirage
#
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

pale vessel
#

he's already dead

slate forge
#

Oh boi

pale vessel
#

anyway lol

spare mirage
#

this is why

slate forge
#

That's why python is easier

pale vessel
#

can you log args?

#

console.log(args)

spare mirage
#

sure!

pale vessel
#

by the way, that's a mention, not an ID ignore this

spare mirage
#

my ban command is different

#

@pale vessel

#

but still works

pale vessel
#

you did it wrong

spare mirage
#

uhh

#

what was wrong

pale vessel
delicate shore
#

Hey guys

pale vessel
#

arrays start from 0

spare mirage
#

oh ye lol

delicate shore
#

Can anyone help me with command handler

earnest phoenix
#

Yea array start from 0 as default index

delicate shore
#

Like how can I shift my code into command handler

#

Because due to all codes in one

#

File

spare mirage
#

const args = message.content.slice(PREFIX.length).split(/ +/);

delicate shore
#

It's getting 2k ping

spare mirage
#

thats not because its all in 1 file

#

thats just ur connection

delicate shore
#

thats not because its all in 1 file
@spare mirage
I host it on glitch

#

thats just ur connection
@spare mirage
100 mb/s

spare mirage
#

thats glitch's connection

delicate shore
#

thats glitch's connection
@spare mirage
Oh but people suggested to keep codes in different files

#

Intact glitch said it themselves

spare mirage
#

it wont matter if u put it in 1 2 3 4 5 or 10000 files

delicate shore
#

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 ?

spare mirage
#

lmao

delicate shore
#

Send code

spare mirage
#

@delicate shore I wouldnt really know tbh I dont use glitch

delicate shore
#

Oh

#

Ok

pale vessel
#

you probably had two instances running

spare mirage
#

wich means?

delicate shore
#

send code

#

Then see

#

There must be

#

Two

#

Embeds

spare mirage
#

no

#

there arnt

#

im not that STUPID

delicate shore
#

Bruh

spare mirage
delicate shore
#

Send the code lol

#

How tf can I tell without it ?

winter basalt
#

you probably had two instances running
this

spare mirage
#

im not leaking code to u xD

delicate shore
#

Lol

spare mirage
#
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)
    ```
delicate shore
#

I was all time here

spare mirage
#

here is my embed

fresh hatch
#

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?

delicate shore
#

When you were asking for code

#

I am PGamerX

#

I just changed my name

#

Sh

earnest phoenix
#

You probably running 2 instance or your bot is responding to itself @spare mirage

spare mirage
#

ok

earnest phoenix
#

@fresh hatch which line?

fresh hatch
#
let question = message.content.slice(client.prefix.length+6
#

and

#
let response = responses[Math.floor(Math.random()*(responses.length))]
weary anchor
#

client.prefix is undefined probably

restive pebble
#

eh

earnest phoenix
#

I'm sure client.prefix is undefined

#

Or doesn't exist

restive pebble
#

hi

earnest phoenix
#

Hey

restive pebble
#

8ball lol

spare mirage
#

imagine making 8ball

#

lol

weary anchor
#

lol

restive pebble
#

justii u were to go in school right?

spare mirage
#

ye im out

#

50 mins school

#

xD

restive pebble
#

ok

#

online lol

spare mirage
#

imagine making 8ball

#

he says

#

8ball.js

#

:/

restive pebble
#

yea

earnest phoenix
#

@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```

spare mirage
#

let PREFIX works good enough

restive pebble
#

no

#

lol

spare mirage
#

am I dumb

restive pebble
#

he cannot acess anywhere

spare mirage
#

mannn I need sleep

fresh hatch
#

ok, i will try

#

prefix is already defined

restive pebble
#

ah

#

client.prefix

earnest phoenix
#

then use prefix.length

restive pebble
#

instead make an array lol

#

and splice 1

fresh hatch
restive pebble
#

lol

earnest phoenix
#

Why an array tho lol

restive pebble
#

split

#

lol

earnest phoenix
#

Bruh

tight plinth
#

What

earnest phoenix
#

Wtf is he doing

restive pebble
#

muhaha

#

10000 balls

earnest phoenix
#

He's beginning to believe

restive pebble
rough mulch
#

Ahh this is where boing hangs xD

restive pebble
#

prefix : any

#

can u move ur cursor pls

earnest phoenix
#

@fresh hatch just try
let prefix = "-";

fresh hatch
#

prefix is already defined

#

in the main js

restive pebble
#

assign it to client.prefix

earnest phoenix
#

then why are you defining it again

restive pebble
#

or u have require everywhere lol

#

and i suggest to use args

#

imagine slicing in every command

earnest phoenix
#

Just use prefix.length and remove the definings of the prefix anywhere on top

fresh hatch
spare mirage
#

why would u use bot.js

restive pebble
#

u know how to require from js files?

earnest phoenix
#

Wtf facepalm

restive pebble
spare mirage
#

hastebin

#

sorry

#

why does this not work

earnest phoenix
#

Hmm...

spare mirage
#

I probably shoulve made a kick command

#

xD

earnest phoenix
#

Wait didn't you already did

#

You just showed us it's code

spare mirage
#

no

#

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

restive pebble
#

voltrex

#

he is importing prefix from discord.js

earnest phoenix
restive pebble
spare mirage
earnest phoenix
spare mirage
#

ok enough spam

#

I have an idea

#

so

#

If I kick someone

earnest phoenix
#

Maybe he forked discord.js and added prefix as a function @restive pebble

spare mirage
#

will it be funny if it said "Message.author You just kicked his ass"

restive pebble
#

read carefully lol

#

const {let prefix

earnest phoenix
#

Ik lol

spare mirage
earnest phoenix
#

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

#

Logic is Infinite here

restive pebble
spare mirage
restive pebble
pure lion
#
      .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

restive pebble
#

===

golden condor
#

@pure lion use !

spare mirage
#

if (!serverQueue.loop == false) {

#

@golden condor u mean this?

golden condor
#

No

#

if(!serverQueue.loop)

spare mirage
#

ahh ok

golden condor
#

Two instances

earnest phoenix
#

why is it sending my msg twice

#

Bot has one instance, I'm sure

restive pebble
#

Where u hosting

spare mirage
#

restarting the bot works

earnest phoenix
#

ptero

spare mirage
#

for me

restive pebble
#

And check it two instances are running

earnest phoenix
#

it isnt

restive pebble
#

But most probably they are not

#

Yes

earnest phoenix
#

when I use help command sends 1 time

restive pebble
#

Restart is best fix

spare mirage
#

^

delicate shore
#

hey

earnest phoenix
#

Can't restart I need uptime

delicate shore
#

i am having issues

#

Can't restart I need uptime
@earnest phoenix for?

earnest phoenix
#

im trying to keep 24/7 uptime

#

I can try reload the eval cmd

delicate shore
#

oh

spare mirage
#

bruh u dont need 100%

#

99% is good enough

delicate shore
#

how to see your uptime time ? @spare mirage

spare mirage
#

you can on toporg

#

I think

finite bough
#

process uptime

restive pebble
#

process has it

finite bough
#

web dashboard

#

of ur vps

delicate shore
finite bough
#

process uptime

delicate shore
#

i have glitch premium

#

it;s on 24*7

#

so

spare mirage
#

anyone know some fun fun commands xD

finite bough
#

my way is to get process uptime

#

then turn it into min hours etc

#

.getUTChours()

#

or smthing like that

restive pebble
#

moment-duration-format

spare mirage
#

anyone know some fun fun commands xD

earnest phoenix
#

It just returns undefined

#

And yes, the res.rows does return the prefix

#

ยฏ\_(ใƒ„)_/ยฏ

rustic ridge
#

the callback runs after the console.log

weary anchor
#

Hi, does anyone know why i cant use this let outside of the callback?
@earnest phoenix because your console.log(prefix) is executed before the callback

rustic ridge
#

the callback is everything that happens after the query

spare mirage
#

how do I generate a random number from 1-100?

rustic ridge
#

google it

#

stack overflow

#

include the language you're using

earnest phoenix
#

Where would i use/define my prefix then?

weary anchor
rustic ridge
#

@earnest phoenix either use async instead of callback or put all your code inside the callback

earnest phoenix
#

So i would do
const prefixGet = await client.query(getPrefixQuery);

and then i got prefixGet.res and prefixGet.err?

weary anchor
#

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

spare mirage
#

I dont have to make a function in a module.exports = { right? what do I use then for a function

weary anchor
#

what do you mean? Thonk

spare mirage
#

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

weary anchor
#

that's ok. but then you can only access the child function within the parent function.

spare mirage
#

wdym

#

would it effect a command handler?

weary anchor
#

like, you can only use getRandomIntInclusive from within execute

spare mirage
#

yes

#

ok

#

thats fine

#

thanks!

weary anchor
#

np

earnest phoenix
weary anchor
#

np :)

spare mirage
#
    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?

earnest phoenix
#

what the...

#

you can do a message event for all commands

#

ยฏ\_(ใƒ„)_/ยฏ

white drum
#

Hey, does anyone know how i can get the heartbeat ping on my bot?

spare mirage
#
 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?
earnest phoenix
#

its a function

spare mirage
#

yes

#

should I make it a var?

earnest phoenix
#

You should do it like getRandomIntInclusive(1233,2939) (example)

white drum
#

Hey, does anyone know how i can get the heartbeat ping on my bot?

spare mirage
#

ahh

#

message.channel.send(getRandomIntInclusive(1, 100)) u mean this?

earnest phoenix
#

yes

white drum
#

:/

spare mirage
#

.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\

restive pebble
#

ping?

earnest phoenix
#

Just message.author

spare mirage
#

no that gave the id

restive pebble
#

no lol

#

it pings

spare mirage
#

how big is ur banana?@spare mirages banana is 94 inches long

#

breh

#

what

earnest phoenix
#

what do you mean?

spare mirage
earnest phoenix
#

I see..

spare mirage
#

fixed

#

I think

#

perfect

restive pebble
#

ok

spare mirage
#

man I love this command

delicate shore
#

hey

#

does anyone know how to make my discord bot

#

play music

#

form spotify

#

because i usally get rate limited

#

from youtube

white drum
#

wdym rate limited?

earnest phoenix
#

Bruh

delicate shore
#

the youtube API

#

rate limit

restive pebble
#

bruh

delicate shore
#

or SoundCloud?

#

anyone

earnest phoenix
#

Lavalink

delicate shore
#

just give me link to any docs of that

#

lavalink

#

any link

restive pebble
delicate shore
#

to docs

spare mirage
#

just search google :3

delicate shore
#

bruh

#

@restive pebble that only work with link

restive pebble
delicate shore
#

and lavalink is py right ?

restive pebble
#

no lol

delicate shore
#

ok

earnest phoenix
#

no lol

restive pebble
#

hi auric

earnest phoenix
#

hi boeing

white drum
#

does anyone know how i can get the heartbeat ping on my bot?

quartz kindle
#

which library

white drum
#

discordjs

quartz kindle
#

v12?

white drum
#

ye

quartz kindle
#

client.ws.ping

low phoenix
#

const broadcastdis = Discord.BroadcastDispatcher(); is that right?

white drum
#

i tried that before and it said something like ping is not defined

quartz kindle
#

@low phoenix client.voice.createBroadcast()

digital ibex
#

@delicate shore yes, lavalink can be used in python

low phoenix
#

okay, and how can i pause the music? @quartz kindle

quartz kindle
restive pebble
#

dispatcher.pause lol

earnest phoenix
#

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

low phoenix
#

Thanks โค๏ธ

#

xd

white drum
#

@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

quartz kindle
#

then use bot.ws.ping

earnest phoenix
#

then it's bot.ws.ping

white drum
#

ill try

earnest phoenix
#

self-explanatory

white drum
#

do i need Math.round?

earnest phoenix
#

no

restive pebble
#

lol

white drum
#

k

quartz kindle
#

speaking of which why is my ws ping so damn high

white drum
#

oof

quartz kindle
#

is discord being bad again

restive pebble
#

why lol

#

and it did one good thing u cannot open blocked msgs on phone

quartz kindle
#

lul

restive pebble
#

ok

white drum
#

ok so it works but the bot says "NaNms"

#

@quartz kindle @earnest phoenix

quartz kindle
#

are you doing weird math on it?

#

show code

earnest phoenix
#

bruh

white drum
#
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);
      }
}
}```
restive pebble
#

lol

earnest phoenix
#

wot

quartz kindle
#

dude...

restive pebble
#

ms

quartz kindle
#

what the fuck

restive pebble
#

lol

white drum
#

.....

quartz kindle
#

you're creating a new client

#

like a completely new separated non-logged-in bot

restive pebble
white drum
#

i have a command handler

restive pebble
#

use normal client

quartz kindle
#

you have to always use your existing client

#

never create a new one

earnest phoenix
#

i have a command handler
@white drum define it in params

restive pebble
quartz kindle
#

unless you want to run multiple bots

restive pebble
#

read lol

quartz kindle
#

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

white drum
#

ahuh..

earnest phoenix
#

at this point you might as well "learn basic js"

quartz kindle
#

i mean

#

its a quite frequent mistake

earnest phoenix
#

true

white drum
#

you dont have to judge me for it

restive pebble
#

my god

earnest phoenix
#

that isn't judging

#

lmao

restive pebble
#

forgive us lol

quartz kindle
#

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

earnest phoenix
#

you dont have to judge me for it
@white drum you've got your help now don't complain about it

quartz kindle
#

also one most people go through lol

#

"what if i close my command line, does it still work? ahh nope"

weary anchor
#

are you doing weird math on it?
lmao weird math ๐Ÿ˜‚

delicate shore
#

Is shit Dev here ?

weary anchor
#

who? lol

delicate shore
#

Ok

#

@pure lion

restive pebble
#

lol

quartz kindle
#

imagine getting help from a shit dev

delicate shore
#

Check dms if you can shit Dev

restive pebble
#

lol

delicate shore
#

Lol

restive pebble
weary anchor
#

lol

delicate shore
#

Should I call him

restive pebble
#

shit dev lmfao

marble geode
#

@delicate shore btw why you no make new yt api?

earnest phoenix
#

lol what

delicate shore
#

I mร de 5

#

Times

#

Still

restive pebble
#

use cheerio lol

delicate shore
#

Google fucking realises

restive pebble
delicate shore
#

use cheerio lol
@restive pebble ?

restive pebble
#

cheerio lol

earnest phoenix
#

npm i cheerio

marble geode
#

cheerio?

#

uhm

#

gimme link to docs @restive pebble

earnest phoenix
#

search it up

restive pebble
#

its inside it lol

#

npmjsโ€™s server IP address could not be found.

quartz kindle
#

their npm page always contains docs or a link to docs

earnest phoenix
#

there since you can't search it yourself

restive pebble
#

lol

#

npm is down

#

:ekek

#

no up

earnest phoenix
#

it isn't

restive pebble
#

the link was bad

earnest phoenix
#

here just forgot the rest of the domain

restive pebble
quartz kindle
#

lmao

earnest phoenix
#

lel

restive pebble
#

lol

#

i got worried lol

delicate shore
#

Pls

restive pebble
#

learn DOM

delicate shore
#

ShitDev com online

restive pebble
#

and JQUERY

marble geode
#

that for html

restive pebble
#

to use cheerio

delicate shore
#

Ok

restive pebble
#

ยฏ_(ใƒ„)_/ยฏ

delicate shore
#

I don't wanna use cheerio

restive pebble
#

ok

earnest phoenix
#

ok sucks to be u

restive pebble
#

stay with rate limits

delicate shore
#

I am gonna use. Lavalinn

restive pebble
#

lol

#

why use lavalink

#

its very easy to set up

delicate shore
#

Not for me

restive pebble
delicate shore
#

Like

#

And

earnest phoenix
#

tough times

delicate shore
#

Cheerio is not used for

#

Nusic

earnest phoenix
#

first world problems

restive pebble
#

actually i never knew if lavalink is a npmjs package

#

lol

earnest phoenix
#

nope

restive pebble
#

oh

delicate shore
#

so he fucking lost BloodBot premium
@earnest phoenix
What is that

earnest phoenix
#

they do have lavalink related npm packages

restive pebble
#

pizza said its very easy

#

oh k

#

yeah

delicate shore
#

send me cherio again pls lol

restive pebble
#

spotify blocks me from scrapping

#

fucking 403 error

delicate shore
#

scrapping

#

?

restive pebble
#

yeah artist details and bio

#

ill use puppeteer instead

delicate shore
#

wtf

#

cherrio

#

is

#

html?

spare mirage
#

cheerio

delicate shore
#

ok

#

lavalink is very difficult

#

i changed my mind

#

code

#

oh wait

#

lol

#

why is noone online?

#

hello?

earnest phoenix
#

chill

#

https://hatebin.com/ggmwdqqjqh nice link

delicate shore
#

noice

spare mirage
#

https://medium.com/free-code-camp/how-to-create-a-music-bot-using-discord-js-4436f5f3f0f8

#

lol

delicate shore
#

hey

spare mirage
#

@delicate shore just use ytdl

delicate shore
#

i just got all the code

#

of lavalink

#

but

#

it's so long

restive pebble
#

in my life i was not able to find lavalink

delicate shore
#

lol

restive pebble
#

and u found code

delicate shore
#

in my life i was not able to find lavalink
@restive pebble lol

#

should i dm u

restive pebble
#

and i dont even wanna find

#

lol

#

lol

delicate shore
#

@restive pebble hey

#

i have a query

restive pebble
#

ok

delicate shore
#
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

spare mirage
#

HASTEBIN

#

again

delicate shore
#

and it said if command