#development

1 messages · Page 917 of 1

earnest phoenix
#

Ahh okay

white anvil
#

implement .delete on base collection and then just call .cache.delete in it?

earnest phoenix
#

I love github lol, reverse changes easily throughout days

#

Hmm makes sense

#

Ill see tomorrow after work

#

Thanks for explaining the stuff lol

white anvil
#

np

quartz kindle
#

damn i hate typescript

earnest phoenix
#

+!help

#

+!fumar

quartz kindle
#

but whoever did this looks like a genius, if i understand correctly they even managed to implement zlib-stream using the native zlib module

#

which took me a lot of shenanigans to implement

white anvil
#

no one knows the api better than cake

amber fractal
#

what does zlib do

white anvil
#

he’s constantly breaking it

#

he managed to break voice so that he could speak in it while muted and deafened, the madlad

quartz kindle
#

lmao

#

hows the caching tho? memory usage and such

white anvil
#

the fact that the lib is in typescript means that the typings are actually correct

#

caching is rlly good, completely under your control

#

you can disable and enable every part of it independently

#

memory usage as a whole could be better tho

#

my bot uses like no cache except messages and uses about 50mb rss

quartz kindle
#

i guess im gonna give up on my lib then

amber fractal
#

no pls

#

I need code to injest

#

code that isnt ts

white anvil
#

just be weary that there is no stable branch rlly

#

all changes are just pushed straight to master

quartz kindle
#

is the lib usable without ts? or does it require your whole bot to be ts?

white anvil
#

but there are no breaking changes ever, just small changes based on what changes in the api

#

no you can use js

half bluff
#

it looks like a good start but I'm not sure if I'm ready to give up Klasa

white anvil
#

all I would say is the docs suck, if you want to know how to do something your best bet is to read the source or ask in the support server

#

the command client is super hot also

#

I use it for my bot

#

it’s very hackable and uses callbacks in a lot of places for a lot of different things

#

if you have a big bot then the cluster client is also very interesting

half bluff
#

I'm using Kurasuta & Discord.js + Klasa

white anvil
#

managing groups of shards

#

I’ve never seen something like this implemented into a lib before

quartz kindle
#

the only reason i started my own lib was to do something that i thought didnt exist, a barebones setup with no management whatsoever, but if this lib can do that, then i dont know why im even doing this

white anvil
#

wdym no management

quartz kindle
#

no caching and handling of data, 1:1 discord-api

half bluff
#

Kurasuta handles clusters as well (groups of shards)

quartz kindle
#

what you see in the discord api docs is what you get

half bluff
#

so same thing as teh ClusterManager more or less

white anvil
#

yeah the rest client especially follows that

#

all functions just take options how the api accepts them

#

no abstraction

half bluff
#

You don't want a helping hand which makes sense. Especially at scale.

white anvil
#

you can also completely disable caching

#

by setting client option cache to false

#

but yeah you have to be patient with the docs, reading source is usually easier

#

since everything is typed

half bluff
#

I'll have to bookmark detritus and wait for v1

white anvil
#

you can just view the types

#

detritus is already in a stable state

#

I think?

quartz kindle
#

discord libs shouldnt have stable versions anyway, since discord api is always changing

white anvil
#

yeah all changes are pushed to master

#

but since there’s no abstraction there can be no breaking changes unless the api has a breaking change

#

well, no abstraction beyond basic stuff like ratelimiting

half bluff
#

Hmm. He probably isn't following semver then?

white anvil
#

@quartz kindle if you want to go really low level there is also a client socket

#

@half bluff not rlly

quartz kindle
#

yeah i was reading its source, trying to figure out how he implemented zlib-stream

white anvil
#

client socket will probably be more useful

half bluff
#

I wonder how the performance compares to Discord.js. Granted I don't run into performance issues that aren't caused by Discord

quartz kindle
#

i hate when code is excessively split all over the place lmao, pain in the ass to read and understand

white anvil
#

he doesn’t use third party deps for any of this btw

#

he even wrote his own rest module

#

@half bluff djs performance is terrible

#

this lib exceeds djs by miles but it’s slightly behind eris

quartz kindle
#

why would it be behind eris?

white anvil
#

because the shard client is slightly more abstracted than eris client

#

idk exactly why

half bluff
#

Eris doesn't really have good strong typescript support does it?

white anvil
#

no

#

eris typings are incomplete and wrong in several places

quartz kindle
#

well, can you disable caching in eris?

white anvil
#

i think so? not sure

quartz kindle
#

besides messages i mean

#

channels, guilds, members, users

white anvil
#

no idea, I can ask

quartz kindle
#

i dont think you can

white anvil
#

if ur too lazy

quartz kindle
#

you can sweep them, but not disable them

white anvil
#

yeah idk

#

I can show you a sample of my client options with detritus

quartz kindle
#

that was my problem with both djs and eris

#

thats why i wrote an anti-caching framework for djs

earnest phoenix
#

highest to lowest

white anvil
#

arr.sort((a, b) => a[1] - b[1])

#

I think

#

might be backwards

half bluff
#

that's where trial and error comes in handy

white anvil
#

tias

half bluff
#

Does Detritus have any third party projects based around it yet?

white anvil
#

uhh some small bots use it

#

notsobot is being rewritten in it using the cluster client

#

which is an example of it being used at scale

quartz kindle
#

is the cluster client designed for multi-machine?

earnest phoenix
#

whats so great about it?

white anvil
#

it’s hackable and modifiable easily

#

uhh I don’t use it

#

it can be used on single machine

#

I think multi machine as well?

quartz kindle
#

there are no good multi-machine systems, thats why i ask

wise quartz
#

how do i remove a percentage from an int? like i wanna remove a 10% from a number. How?

half bluff
#

Like your number is 5.10 and you want to remove the .10?

wise quartz
#

no its without .00

#

a normal num like 1 2 3 4

#

not float

half bluff
#

Oh. You've got a string you want to convert to an int

white anvil
#

const number = 1234
const percent = number / 10
const result = number - percent

#

?

wise quartz
#

Oh. You've got a string you want to convert to an int
@half bluff no

#

python btw

white anvil
#

same thing just change the syntax

half bluff
#

@quartz kindle For multi-machine kurasuta handles it?

wise quartz
#

i am making an economy system and i added this command called transfer that lets you transfer an amount from your bank/credit into another persons bank/credit and i wanted to add a fee system for example 10% fee for every transaction so how would i do that?

half bluff
#

what

#

You don't now how to take 10% off of a number?

wise quartz
#

no...

half bluff
#

100 * .1 = 10% of 100 = 10

#

So in your transfer logic you do amount * .9 as the transferred amount

#

and if you're moving the 10% somewhere you can do amount * .1

#

but if you're just evaporating it you only have to worry about the * .9

wise quartz
#
remamt = int(amount) - (100 * .1)
#

like that?

#

i am a bit confuzed bc i never did something like this before tbh..

half bluff
#

No not like that

#
remamt = int(amount) * .1
#

I'm assuming (I don't use Python)

copper cradle
#

yeah that should work

wise quartz
#

but i dont get it...

#

i need it to remove 10% from my int

half bluff
#

Yes.

wise quartz
#

not make my amount to a float number

half bluff
#

so if you're removing 10% you do .9 instead of .1

#

and if you don't want a float you'll have to round it

wise quartz
#

so

#
remamt = int(amount) * .9
#

will remove 10% from

#

my amount

#

?

#

thats just multiplying tho... where the removing part?

#

i really confuzed.. 😅

half bluff
#

If you multiple something by 0.9 it removes

#

10%

#

from the value

wise quartz
#

owhhh

#

then my amount will be a float and i'll have to round it so i get the results that i need right?

#

alr lemme try it

half bluff
#

I googled it. Apparently int() in python rounds

#

so

#
amount = '100'
remamt = int((int(amount) * .9))
print(remamt)
#

if you remove 10% from 100 you get 90

#

it'll print 90

#

as an int

wise quartz
#

alr i see

#

thanks sm

copper cradle
#

dude

opaque seal
#

What's the best practice for listening to reactions on uncashed messages?

queen needle
#
 const Canvas = require("canvas");
  if (message.content.startsWith(prefix + "triggered")) {
  


  const canvas = Canvas.createCanvas(200,200);
    const ctx = canvas.getContext('2d');

    const background = await Canvas.loadImage('https://cdn.glitch.com/32b593a8-b636-49b1-8f62-c50f49f186fe%2F200.gif?v=1588981925859');
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

    ctx.strokeStyle = '#74037b';
    ctx.strokeRect(0, 0, canvas.width, canvas.height);

    // Wait for Canvas to load the image
    const avatar = await Canvas.loadImage(message.author.displayAvatarURL);
    // Draw a shape onto the main canvas
    ctx.drawImage(avatar, 0, 0, 250, 160);
    const attachment = new Discord.Attachment(canvas.toBuffer(), 'welcome-image.png');

    message.channel.send(`**triggered**`, attachment);
  }```
#

how could i make it so the image is a gif?

quartz kindle
#

canvas doesnt support animated gifs

queen needle
#

oh

#

what does

wise quartz
#
amount = '100'
remamt = int((int(amount) * .9))
print(remamt)
#

after alot of fixing

#

and testing around

#

turns out as i thought

#

this just multiplies

#

and not removes...

#

anyone got a better silution?

#

(python: GWcodesPython)

half bluff
#

Sounds like you need to further clarify what exactly you mean.

wise quartz
#

i just need to remove 10% from an amount.

half bluff
#

At this point with the language barrier(?) perhaps some examples of what you're trying to accomplish?

#

Is your goal to have remamt be the 10% value of the remainder (the 90%) value?

wise quartz
#

i just need to remove 10% from an amount for example 20000 and thats it.

half bluff
#

So what's 20000 after you remove 10%?

#

20,000 - 10% is 18,000

#

So your goal is to get the 18,000 number right

#

so you can save it to your database

wise quartz
#

yes

half bluff
#

That's exactly what my code I sent you does.

#

So I'm not quite sure what issue you're running into

wise quartz
#

what your code does is

#

it makes the 20k into 36k

#

thats the results i got

half bluff
#

Something must be screwed up in the logic somewhere then

wise quartz
#

i just did

half bluff
#

That outputs 18,000

wise quartz
#
addamt = int((int(amount) * .9))
#

thats what i did

#

and it didnt work

half bluff
#

and what are you doing with addamt?

#

because it still results in 18,000

wise quartz
#

add it to the bank of the given user

half bluff
#

so there is something else going wrong. Do you have a bigger code example?

wise quartz
#

lemme show u

#
            addamt = int(pbank) + int(amount)
            addamtwithfee = int((int(addamt) * .9))
            remamt = int(amount) - int(bank)
            db.child(ctx.guild.id).child(member.id).update({"wallet": pwallet, "bank": addamtwithfee})
            db.child(ctx.guild.id).child(ctx.author.id).update({"wallet": wallet, "bank": remamt})
#

if your wondering what the hell is that database then.. its firebase 😆

#

prob the first person u see using it

#

lol

half bluff
#

So to break it down - I assume "pbank" is the current value in the players bank?

#

And "amount" is the amount argument passed to the command, in string form (considering you're converting to int)

wise quartz
#

yes

queen needle
#
  
  if(message.content.startsWith(prefix + 't')){
    const GIFEncoder = require('gifencoder');
const { createCanvas } = require('canvas');
const fs = require('fs');
 
const encoder = new GIFEncoder(320, 240);
// stream the results as they are available into myanimated.gif
let ad = encoder.createReadStream().pipe(fs.createWriteStream('myanimated.gif'));
 
encoder.start();
encoder.setRepeat(0);   // 0 for repeat, -1 for no-repeat
encoder.setDelay(500);  // frame delay in ms
encoder.setQuality(10); // image quality. 10 is default.
 
// use node-canvas
const canvas = createCanvas(320, 240);
const ctx = canvas.getContext('2d');
 
// red rectangle
ctx.fillStyle = '#ff0000';
ctx.fillRect(0, 0, 320, 240);
encoder.addFrame(ctx);
 
// green rectangle
ctx.fillStyle = '#00ff00';
ctx.fillRect(0, 0, 320, 240);
encoder.addFrame(ctx);
 
// blue rectangle
ctx.fillStyle = '#0000ff';
ctx.fillRect(0, 0, 320, 240);
encoder.addFrame(ctx);
 
encoder.finish();
 
  }``` so im trying to use gif encoder but i cant figure out how to send it
wise quartz
#

"wallet" is the author's wallet value and
"bank" is the author's bank value and
"pwallet" is the member's wallet value and
"pbank" is the member's bank value.

half bluff
#

so we aren't changing wallet or pwallet correct?

wise quartz
#

no

#

pwallet and wallet stays the same

quartz kindle
#

@queen needle you can send the stream directly to discord

wise quartz
#

only banks

#

changes

half bluff
#

the goal is to take amount from bank and deposit it in pbank, minus a 10% fee?

wise quartz
#

exactly

half bluff
#

so say pbank = 100K
and bank = 100K
and amount = 20K

after the transfer bank should have 80K and pbank should have 118K

wise quartz
#

exactly

queen needle
#

How

quartz kindle
#

@queen needle js let stream = encoder.createReadStream(); message.channel.send({files:[{attachment:stream,name:"myfile.gif"}]})

wise quartz
#

so say pbank = 100K
and bank = 100K
and amount = 20K

after the transfer bank should have 80K and pbank should have 118K
@half bluff so do you know how to make that happen?

half bluff
#
# amount being transacted
amount = '20000'
# author (giver) bank
bank = '100000' 
# receiver bank
pbank = '100000'

fee = int(int(amount) * .1)

bank = int(bank) - int(amount)
pbank = int(pbank) + (int(amount) - int(fee))

print("author bank", bank)
print("receiver bank", pbank)
print("author paid",fee,"fee")
#

This is how I would do it @wise quartz

wise quartz
#
fee = int(int(amount) * .1)

bank = int(bank) - int(amount)
pbank = int(pbank) + (int(amount) - int(fee))
queen needle
#

@quartz kindle do you know how i could set the background to a image i already have

wise quartz
#
fee = int(int(amount) * .1)

bank = int(bank) - int(amount)
pbank = int(pbank) + (int(amount) - int(fee))

^^^ alr i will try this ^^^

queen needle
#
if (message.content.startsWith(prefix + "t")) {
    const GIFEncoder = require('gif-encoder-2')
const { createCanvas } = require('canvas')
const { writeFile } = require('fs')
const path = require('path')

const size = 200
const half = size / 2

const canvas = createCanvas(size, size)
const ctx = canvas.getContext('2d')

function drawBackground() {
  ctx.fillStyle = '#ffffff'
  ctx.fillRect(0, 0, size, size)
}

const encoder = new GIFEncoder(size, size)
encoder.setDelay(500)
encoder.start()

drawBackground()
ctx.fillStyle = '#ff0000'
ctx.fillRect(0, 0, half, half)
encoder.addFrame(ctx)

drawBackground()
ctx.fillStyle = '#00ff00'
ctx.fillRect(half, 0, half, half)
encoder.addFrame(ctx)

drawBackground()
ctx.fillStyle = '#0000ff'
ctx.fillRect(half, half, half, half)
encoder.addFrame(ctx)

drawBackground()
ctx.fillStyle = '#ffff00'
ctx.fillRect(0, half, half, half)
encoder.addFrame(ctx)

encoder.finish()

const buffer = encoder.out.getData()

let ad = writeFile(path.join(__dirname, 'output', 'beginner.gif'), buffer, error => {
  message.channel.send(ad)
})
  }``` it says cant swnd empty message
half bluff
#

@wise quartz If you transferred 20K an the guy originally had 20K wouldn't that be the expected result?

wise quartz
#

He had 0 in his bank

#

But i only had 20k on my bank

#

If thats what u mean

half bluff
#

So something is screwed up in the logic again. The code I sent you worked. I even sent you the online IDE showing it working as well.

#

Can you DM me the full command so I can try to wrack through the logic?

#

or post it here idc

#

It shouldn't be this complicated I'm not quite sure what is being done wrong.

wise quartz
#

Alr i'll dm you it

#

But just saying if you try it on ur end

#

It wont work

#

Cuz the database i am using

#

Requite some private stuff

#

That i cant share

half bluff
#

I know it won't. I'm just trying to go over the logic

wise quartz
#

Alr lemme send u it

#

I'll make it a pastebin

#

Cuz rn i am on my phone

#

Uhm listen i cant rlly send it to u now cuz i turned off my laptop and accessing github from my phone is a bit laggy so tmr alr.@half bluff gn

half bluff
#

gn

late plank
#

discord.js v12: What exactly does guild.fetch() accomplish?

amber fractal
#

probably fetch and cache a guild

late plank
#

I'm curious what it caches

sonic copper
#

Question friends, I think I'm missing something. I can get a role by it's ID no problem. But, how do I get it by name?

late plank
#

would that include channels?

#

@sonic copper loop roles, compare names

amber fractal
#

idk

late plank
#

okie; just wanted a sanity check that it does help with caching

#

ty

sonic copper
#

I found an easier way to do it other than looping through roles 😄

#
message.guild.roles.cache.find(role => role.name === "Role Name")
hardy vector
#
if (message.content === "=buy computer") {
    let user = message.mentions.users.first() || message.author;
    let items = await db.fetch(`items_${user.id}`)
    items.push(`items_${user.id}`, 'computer')
}

if (message.content === "=inventory") {
    let user = message.mentions.users.first() || message.author;
    let items = await db.fetch(`items_${user.id}`)
    
    let embed = new Discord.MessageEmbed()
    .setColor("BLURPLE")
    .addField("items", items)
    message.channel.send(embed)
}```
 when i use buy commadn this happens
(node:16219) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'push' of null
    at Client.<anonymous> (/Users/sadashivappakenchannavar/Desktop/Rusty Beta/bot.js:112:11)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:16219) 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:16219) [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.
can someone help me
queen needle
#

do you have a file named bot.js?

hardy vector
#

yes

queen needle
#

Go to line 112 copy it and send that

hardy vector
#

items.add(items_${user.id}, 'computer')

queen needle
#

Why are you trying to push an item?

hardy vector
#

cos its part of the buy command?

amber fractal
#

items is null

#

(he already posted the code btw)

hardy vector
#

yea i did lol

amber fractal
#

await db.fetch(`items_${user.id}`) is returning null for whatever reason

#

Idk what db you use, and even if I did, I wouldn't know how it worked, but that may help others assist you

hardy vector
#

quick.db

#

@queen needle what is it

queen needle
#

What

hardy vector
#

i sent my code above

solid spear
#

Anyone know the gist of using emote reactions for pagination in JDA?

#

Specifically just how to handle the event/callback

hardy vector
#

JDA = bad

copper fog
#

How can I know a user has voted my bot or not?

knotty steeple
#

@hardy vector quick.db = bad :)

#

ur shop system is shit btw

hardy vector
#

lol i agree

#

what should i do

#

sqlite?

#

i chose quick.db cos its quick and easy

knotty steeple
#

sql is easy

queen needle
#
if (message.content.startsWith(prefix + "blur")) {
    const canvas = Canvas.createCanvas(200, 200);
    const ctx = canvas.getContext("2d");

    const background = await Canvas.loadImage();
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

    ctx.fillStyle = "#ffffff";
    ctx.filleRect(0, 0, canvas.width, canvas.height);
    ctx.filter = "blur(5px)";
    const avatar = await Canvas.loadImage(message.author.displayAvatarURL);
    // Move the image downwards vertically and constrain its height to 200, so it's a square
    ctx.drawImage(avatar, 25, 25, 200, 200);

    const attachment = new Discord.Attachment(
      canvas.toBuffer(),
      "welcome-image.png"
    );
    // Wait for Canvas to load the image

    message.channel.send(attachment);
  }``` im trying to create a command to blur a persons profile picture but its not sending anything
#

and theres no errors

#

i got it to send the image but its not blurrying it

#

nvm

earnest phoenix
#

@queen needle t fr?

queen needle
#

what

earnest phoenix
#

Non rien

#

Nothing

weak tree
#

my bot got whitelisted in discord now waiting for Top.gg to approve my bot but soon

#

i worked so hard

queen needle
#
if (message.content.startsWith(prefix + "blur")) {
   let jimp = require("jimp")
   const user = message.mentions.users.first() || message.author;
  
let welcome = await jimp.read(message.user.displayAvatarURL) //We load the image from that link
welcome.gaussian(2.5);
welcome.write('Welcome2.png') //We create a png file called Welcome2
message.channel.send(``, { files: ["Welcome2.png"] }) //We sent the file to the channel
  }``` cant read properpty of displayAvatarURL
earnest phoenix
#

Discordjs version?

weak tree
#

wait

queen needle
#

11.5.3

earnest phoenix
#

jimp.read(user.displayAvatarURL)

#

See if it works

#

U should upgrade to v12

#

my bot got whitelisted in discord now waiting for Top.gg to approve my bot but soon
@weak tree
Whitelisted?

weak tree
#

yes

earnest phoenix
#

Verified Bot Developer

weak tree
#

dwb

earnest phoenix
#

?

#

you don't have the badge lol

weak tree
#

dont mean that

#

i dont mean that lol

queen needle
#

@earnest phoenix it works but it doesnt blur the person i mention

earnest phoenix
#

Cool

weak tree
#

||mention||

#

here

queen needle
#

how is that cool it doesnt work?

weak tree
#

dk

#

|| ||

earnest phoenix
#

welcome.gaussian(increase it)

#

try this ^

#

can we use express and dbl webhook at the same time?

#

welcome.gaussian(5) @queen needle

#

If not blurred increase it

pliant portal
#

When we submit our bot for review its being tested using permissions=0 how would they be able to test admin only commands?

earnest phoenix
#

Umm
Admins can use admin only commands

pliant portal
#

oh crap

#

you right LMAO

#

oops

earnest phoenix
#

i think permissions=0 will give no role on joining

#

Im making a captcha verification bot with no external packages XD

pliant portal
#

way out of my league lol

cinder patio
#

What's the best way of detecting that a websocket client has refreshed the page / reconnected very quickly

queen needle
#

@earnest phoenix i did that once

earnest phoenix
#

ok

wicked pivot
#

someone would have an example of a "chartjs-node-canvas" code

distant plank
#

Why did my bot turn off for no reason? :C

earnest phoenix
#

sorry i broke my crystal magic ball so unfortunately you will have to tell us that

#

@distant plank see logs

#

There must be any error

#

fix that error and restart bot

distant plank
#

@earnest phoenix nop, in the console there are no errors

earnest phoenix
#

then Restart bot

#

What are u using to host bot

distant plank
#

Glitch

earnest phoenix
#

Bot will go offline after 5 mins if its inactive

#

use uptimerobot to keep it online

#

brb

distant plank
#

@earnest phoenix ready.
Now do I have to wait?

earnest phoenix
#

Hey, I am super new to discord bots and coding in general, should I start writing my base code in index.js or another file?

marble juniper
#

doesn't really matter how you name your file so

earnest phoenix
#

so just any file will work?

marble juniper
#

any file name will work

#

as long as you have .js at the end

earnest phoenix
#

okay, thanks!

wicked pivot
#

hello I want to make a system of "rank", problem I think that I did something wrong somewhere because it does not work

#
const canvas = createCanvas(1000, 333);
    const ctx = canvas.getContext('2d');
    const xp = "600"
    const lvl = "1000"

    let image = await loadImage("https://cdn.discordapp.com/attachments/412414337848967185/708564854096789535/fond-couleur-noir-dim33x23cm.jpg")
    ctx.drawImage(image, 0, 0, canvas.width, canvas.height)

    ctx.beginPath()
    ctx.lineWidth = 4
    ctx.strokeStyle = "#ffffff"
    ctx.globalAlpha = 0.2
    ctx.fillstyle = "#000000"
    ctx.fillRect(180, 216, 770, 65)
    ctx.fill()
    ctx.globalAlpha = 1
    ctx.strokeRect(180, 216, 770, 65)
    ctx.stroke()

    ctx.fillstyle = "#000000"
    ctx.globalAlpha = 0.6
    ctx.fillRect(180, 216, ((100 / (lvl) * xp) * 7.7, 65))
    ctx.fill()
    ctx.globalAlpha = 1


    ctx.font = "30xp Arial"
    ctx.textAlign = "center"
    ctx.fillStyle = "#ffffff"
    ctx.fillText(`${xp} / ${lvl}`, 600, 255)

    ctx.textAlign = "left"
    ctx.font = "50px Arial"
    ctx.fillStyle = "#000000"
    ctx.fillText(message.author.tag, 300, 180)

    ctx.arc(170, 160, 120, 0, Math.PI * 2, true)
    ctx.lineWidth = 6
    ctx.strokeStyle = "#ffffff"
    ctx.stroke()
    ctx.closePath()
    ctx.clip()
    const avatar = await loadImage(message.author.displayAvatarURL)
    ctx.drawImage(avatar, 40, 40, 250, 250)```
earnest phoenix
#

hm

#

@distant plank

#

Done with uptimerobot?

#

Since I shard I have this error here: await client.channels.cache.get (" 620548901258133515 ").send
cannot read proprety send but the channel exist..

#

@wicked pivot Increase size of text its very small

#

client.channels.cache.get("id").send

wicked pivot
#

this is not the problem, in the "rectangle" it is supposed to have the progression of the user

earnest phoenix
#

i have do this @earnest phoenix

#

Hmm

restive furnace
#

client.broadcastEval(client.channels.get(...))

earnest phoenix
#

uh yeah thx

#

add cache after channels if its v12

#

client.broadcastEval(client.channels.cache.get("id").send)

restive furnace
#

ye or client.shards.broadcastEval, im not sure try both

earnest phoenix
#

ok i try

#

send is good placed?

restive furnace
#

ye

#

i found this on stackoverflow: await shardingManager.broadcastEval(`this.guilds.get('352896116812939264').roles`);

earnest phoenix
#

i don’t use shardingManager

#

i use internal sharding

restive furnace
#

oh...

#

lemme check

distant plank
#

@earnest phoenix yes

restive furnace
#

client.shard.broadcastEval(`this.guilds.size`) @earnest phoenix try this does this return array of guild sizes in different shards?

earnest phoenix
#

ye is good this

#

await client.shard.broadcastEval(client.channels.cache.get("620548901258133515")).send

Cannot read proprety send

distant plank
#

@earnest phoenix but the bot is still off

earnest phoenix
#

Umm

#

@restive furnace ^

restive furnace
#

kk

#

try then let a = await client.shard.broadcastEval(`client.channels.get("id")`) and then try to send like a.send("smh") @earnest phoenix

earnest phoenix
#

ok

royal herald
#

(node:2747) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined
(u = message.mentions.users.first() || message.author;)
u.roles.filter(r => r.name != @everyone).join(",")
Discord js 11.6.3

restive furnace
#

u.roles doesnt exists

#

and its message.mentions.first

#

and it needs to be member, like user.member to get member object of it

earnest phoenix
#

How can i embed a message into another like NQN bot

#

what

restive furnace
#

\n

earnest phoenix
#

NQN bot makes a webhook of that message from its message link

#

???

restive furnace
#

i dont know 'NQN' bot

earnest phoenix
#

idk what it is called
I want to add this feature in my bot

#

that just takes message data and puts some properties in an embed

#

and then sends it off via a webhook

#

How to do this

#

in which library

#

Discordjs

#

this is everything you need in order

earnest phoenix
#

same error @restive furnace

restive furnace
#

what error

#

and what code did u use

#

@earnest phoenix

earnest phoenix
#

try then let a = await client.shard.broadcastEval(`client.channels.get("id")`) and then try to send like a.send("smh") @earnest phoenix
@restive furnace

#

This and client is not defined

restive furnace
#

give your full code (in dms with removed token if u are scared someone steals ur code)

earnest phoenix
#

is in the guildCreate.js file

restive furnace
#

kk send me the file

#

or code

earnest phoenix
#

np

restive shell
#

does anyone know how to remove a guildId from all the tables in MYSQL ?

wicked pivot
#
if(fetchedMsg <= "5000"){
        var lvl = "5000"
        var grade = message.guild.roles.get('703581177755467856').name
    }else if(fetchedMsg >= "15000"){
        var lvl = "15000"
        var grade = message.guild.roles.get('703583285854601276').name
    }else if(fetchedMsg >= "30000"){
        var lvl = "30000"
        var grade = message.guild.roles.get('703583233031274548').name
    }else if(fetchedMsg >= "50000"){
        var lvl = "50000"
        var grade = message.guild.roles.get('707659936859029544').name
    }else if(fetchedMsg >= "100000"){
        var lvl = "100000"
        var grade = message.guild.roles.get('708027073905819669').name
    }else if(fetchedMsg >= "1000000"){
        var lvl = "1000000"
        var grade = "Tu n'a plus aucun grade à débloquer maintenant c'est que du fun mon ami"
    }```
tight plinth
restive furnace
#

it will

#

its just slower than d.js

tight plinth
#

its beeen 5 minutes

restive furnace
#

wait lemme look how i did it on my old eris bot

#
    bot.editStatus('idle', {
        name:"hi",
        type: 2,
        url: 'https://twitch.tv/ninja'})
#

from my old bot

restive shell
#

can someone help me ?

#

is there a way to delete guildId from all the tables in MYSQL ?

restive furnace
#

@tight plinth

#

thats how u do it

tight plinth
#

hmm

rotund slate
#

can someone plzz help mw

#
3|Lavalink  | 2020-05-09 00:05:23.143  INFO 5936 --- [     parallel-1] s.n.m.impl.connections.AudioWebSocket    : Closing```
tight plinth
#

seems to have worked

white anvil
restive furnace
#

but whats the point using different machines per cluster?

white anvil
#

load balancing

#

you can have multiple clusters on one machine as well lol

#

it’s the exact same thing

earnest phoenix
#

i need some help with leveling system

pale vessel
#

just ask

earnest phoenix
#

@fossil ice explain

#

at what point are you having difficulties?

#

point out your language/library so others can help

#

Ah yes sure

#

just leave

#

we can definitely help you when you leave

#

god damn it

heavy marsh
#

Using discord.js v12 is it possible to get the number of servers the user owns - From the servers the bot is on. The bot has been sharded

earnest phoenix
#

i need help

#

I have the leveling system

#

and it works

#

but i need the level command

#

to check what level i am

#

can anyone help me

heavy marsh
#

Wait patiently

earnest phoenix
#

Okay Sure

thorny meteor
#
message.channel.updateOverwrite(channel.guild.roles.everyone, {SEND_MESSAGES: flase});```It says this has error but dont understand what id it
earnest phoenix
#

But for what tho @heavy marsh

heavy marsh
#

To get help for your question

earnest phoenix
#

ok lol

pale vessel
#

you can use filter

#

filter client's guilds

#

where the owner is author id

heavy marsh
#

ThinkingGlobal yes

pale vessel
#

easy

heavy marsh
#

But I will have to use shardmanger right?

pale vessel
#

yeah if you're sharding

heavy marsh
#

yep the bot is sharded

pale vessel
#

just use fetchClientValues

earnest phoenix
#

can anyone help

restive furnace
pale vessel
#

ummm. access the db and look for the level?

earnest phoenix
#

What's a db 😅

restive furnace
#

database

thick granite
#

@willow frigate

earnest phoenix
#

no random pings angeryBOYE

heavy marsh
#

Ok I am confused on how to filter

thorny meteor
#
message.channel.updateOverwrite(channel.guild.roles.everyone, {SEND_MESSAGES: flase});```It says this has error but dont understand what is it
#

Help me plz

#

error is message.channel undefined

heavy marsh
#
const promises = [
bot.shard.fetchClientValues('guilds.cache.size'),
];

Promise.all(promises).then(results => {
const totalOwned = results[0].filter(g => g.ownerID === e.UserID , 0);

message.channel.send(totalOwned)
});```
Is it like this? - @pale vessel
earnest phoenix
#

@thorny meteor it is false not flase

obsidian pier
#

Yo

#

D'où you skip french

thorny meteor
#

yea

#

my bad

obsidian pier
#

Ok

thorny meteor
#

but thats not the err

obsidian pier
#

Tes France

#

La france

earnest phoenix
#

no french

heavy marsh
#

Then send in the error

obsidian pier
#

Them send in the error

#

Them send in the error

#

@obsidian pier

heavy marsh
pale vessel
#

where did you get e?

heavy marsh
#
premiumdb.find({}, (err, res) => {
if (err) return resolve([]);
if (!res) return resolve([]);
res.toArray().then(resolve);
});
})).map((e, i) => `${i + 1}. <@${e.UserID}> \`[ ${e.UserID} ]\` | Premium: \`${e.premium}\``);
pale vessel
#

oh

#

well try it

heavy marsh
#

Ofs

#

oks*

#

I got object promise

#
premiumdb.find({}, (err, res) => {
if (err) return resolve([]);
if (!res) return resolve([]);
res.toArray().then(resolve);
});
})).map((e, i) => `${i + 1}. <@${e.UserID}> \`[ ${e.UserID} ]\` | Premium: \`${e.premium}\` | Servers: \`${Promise.all(promises).then(results => { results[0].filter(g => g.ownerID === e.UserID , 0)})}\``);
dense glen
#

@bitter sundial can I ask you a question?"

heavy marsh
#

👀

pale vessel
#

just ask smh

#

you already pinged him

heavy marsh
#

Am I messing it up?

pale vessel
#

i've never used this method before so i'm not sure

heavy marsh
#

Is there any other method ?

pale vessel
#

don't think so

heavy marsh
#

ooh am ok

earnest phoenix
#

@heavy marsh is that for your bump bot

#

haha

heavy marsh
#

Nope

earnest phoenix
#

fairs just wondered

#

so im having problems with mine

#

apprently this is not defined according to someone

#

as it keeps letting me bump over and over again

#

const timeDifference = result[0].timeDifference ? result[0].timeDifference : 3600;

#

const remainingMinutes = Math.floor((cooldown - timeDifference) / 60) const remainingSeconds = timeDifference - remainingMinutes * 60;

#

fetch("WEBHOOK URL HERE", {

                    method: "POST",
                    headers:{
                        'Content-Type' : "application/json"
                    },
                    body: JSON.stringify({
                        embeds: [
                          {
                             title: `${client.emotes.leave} Serveur en moins`,
                             thumbnail: {url: guild.icon ? guild.iconURL() : `https://dummyimage.com/128/7289DA/FFFFFF/&text=${encodeURIComponent(guild.nameAcronym)}`},
                             color: "RED",
                             fields: [
                                {name: "👑 Propriétaire: ", value: guild.owner.user.username, inline: true},
                                {name: "📋 Nom du serveur :", value: guild.name, inline: true},
                                {name: "👤 Nombre de membres :", value: guild.memberCount, inline: true},
                                {name: "🛠 __Identitiant du shard__ :", value: guild.shard.id, inline: true}
                             ]
                          }
                        ]
                    })
                })```


This code is in my guildDelete event, the URL is good, node-fetch is installed, but the bot don’t send the webhook embed. There are no one error in the console. how can i do?
cinder patio
#

There probably is an error in the response

earnest phoenix
#

why are you using fetch

#

discord.js already wraps webhooks

late plank
#

hey all; how would you go about sending an embed to a text channel on a different shard

#
dispatch(content, channel) {
    let e = `
    (async () => {
        let channel = await this.channels.fetch("${channel}");
        if (!channel)
            return;

        channel.send(${content});
    })();
`
    console.log(e);
    this.client.shard.broadcastEval(e);
}
#

obviously wont work

earnest phoenix
#

how to add unknown message command

#

I tried this

#
@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        return
    raise error
    await ctx.send(":replit: Unkown Command.")   ```
#

how i can make bot display the wiget

queen needle
#
  if(message.content.startsWith(prefix + 'restart')){
         resetBot(message.channel)
    function resetBot(channel) {
    // send channel a message that you're resetting bot [optional]
    message.channel.send('Restarting...')
    .then(msg => client.destroy())
    .then(() => client.login(token))
      .then(message.edit("Restarting has finished"))
     
}
    }```
#

how can i edit the message?

warm marsh
#

Grab the message on start and edit it.

earnest phoenix
#

how to add unknown message command
@earnest phoenix don't do that

#

why?

#

why not @earnest phoenix

warm marsh
#

Someone does haha!

#

then it calls or something

earnest phoenix
#

two line breaks is one in markdown @earnest phoenix

#

a

#

it looks the same

#

@earnest phoenix it's a bad practice and your bot will get muted in every bot list server you're in, it's annoying to your end user and you're wasting a request on the 5/5 ratelimit

queen needle
#

how could i add a await in a .then

earnest phoenix
#

you don't

#

@earnest phoenix oh alright

queen needle
#

why not

#

nvm

earnest phoenix
#

because that's not how async works?

#

@earnest phoenix oh, worked now, thanks

#

you either use await/async or promise design

#

what

late plank
#

it's been a couple hours of struggle and I could use the help

queen needle
#

i would help if i could but i dont even know what a shard is

quartz kindle
#

@late plank broadcastEval can only send primitive data, so you either need to stringify the embed, or build the embed inside the eval

queen needle
#
 if (message.content.startsWith(prefix + "ninjakill")) {
    if (message.author.id == "408080307603111936")
      return message.reply("lol no your blacklisted");
    if (message.author.bot) return;
    if (message.mentions.users.first().id === message.author.id)
      return message.reply("You cant kill yourself");
    message.delete()

    message.channel.send(args[0] + " was killed");
  }```
#

it doesnt delete my message?

pale vessel
#

because you returned

earnest phoenix
#

maybe your bots has no perm?

pale vessel
#

learn how to use return

#

it should be the last thing you use

#

you don't even need it

queen needle
#

i thought it was a replace for else?

pale vessel
#

nope

queen needle
#

i do for the message.author part

pale vessel
#

that's fine

#

but you have more script after the reply

#

so you can't return message.reply

queen needle
#
if (message.content.startsWith(prefix + "ninjakill")) {
    if (message.author.id == "408080307603111936")
      message.reply("lol no your blacklisted");
    if (message.author.bot) return;
    if (message.mentions.users.first().id === message.author.id)
      message.reply("You cant kill yourself");
    message.delete();

    message.channel.send(args[0] + " was killed");
  }
#

so like that

pale vessel
#

yes

#

you can put return on channel.send

#

because it's the last thing

queen needle
#

yeah but do i need to?

pale vessel
#

but you can omit it yes

#

you don't need to

queen needle
#

okay thank you

pale vessel
#

by the way, you should put message.author.bot outside commands so that you don't need to repeat it

#

must be in the message event though

nocturne grove
#

lol I just saw I changed a href markdown on my top.gg page for all href's there are 😂 (please don't look at it)
How to solve it? Can I just use another word/character?

pale vessel
#

what do you mean

nocturne grove
#

oh right, I don't explain it correctly. So I added some a href things to my section of the bot page and gave it some style (the a element), but now other standard buttons like Join support server are also with that markdown.

#

oh why don't I just try and see

#

no it doesn't work

pale vessel
#

you need to make it specific to that link only

nocturne grove
#

can't I use something live <div> and give it an id and I can give style to that id?

pale vessel
#

yes

#

just give the link an id

#

you don't need div

nocturne grove
#

okay thanks will try

pale vessel
#

<a href="" id="unique">hi</a>

#unique {

}

nocturne grove
#

oh yes it works (but without #)

pale vessel
#

a class would work too

nocturne grove
#

now it still works with #

#

is there any difference between class and id or not?

pale vessel
#

id is primarily for one thing

#

class is for multiple elements

slender thistle
#

There can be multiple elements with the same class

pale vessel
#

well, id too

slender thistle
#

id is unique so you can only have one element with a certain- oh?

pale vessel
#

but it shouldn't be used like that ye

#

like in js id is supposed to be unique

nocturne grove
#

oh so if I want to use that style more often I should/you recommend using class?

pale vessel
#

yes

#

so if you're styling a button, you would need class and if you're styling a logo, you would need id, something like that

nocturne grove
#

oh okay thnx 👍

pale vessel
#

because you'd typically have many buttons but one logo

nocturne grove
#

yes but I don't have many now as I'm a noob 😁

pale vessel
#

but when you need more, you can apply the same class

nocturne grove
#

okay right

left delta
#

I have a question

#

my bot was rejected because of safe search

#

however I have enabled that

gilded plankBOT
#

Your bot was likely declined because it broke one of the "bot rules" listed in #rules-and-info.

To find out why your bot was declined and by who, use the search feature in #mod-logs:

left delta
#

but does urban dictionary count as nsfw

pale vessel
#

yes

slender thistle
#

Yes

left delta
#

oh

slender thistle
left delta
#

where can I sak that?

pale vessel
nocturne grove
#

how can I even set the background for the window I can edit of my bot's page? body doesn't work, section doesn't work (when I do all my html in between <section></section>) and just background-color does not work

restive night
#

I white this in my index.js but my bot not divided into several shards. Do I have to add something in my bot.js?

const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./bot.js', { token: 'token' });

manager.spawn();
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));```
nocturne grove
#

how can I even set the background for the window I can edit of my bot's page? body doesn't work, section doesn't work (when I do all my html in between <section></section>) and just background-color does not work
I tried ctrl shift C and I and I found the long description has class "longdescription" and/or "content"

tight plinth
#

@restive night manager.spawn([number of shards])

cinder patio
#

Menno try putting !important

nocturne grove
#

@cinder patio oh yes it's working, hero

maiden mauve
#

Hey quick question

#

If you want your bot to use custom emojis, it points to a dedicated url to a custom server right

#

is there something more permanent than that type of url?

nocturne grove
#

@maiden mauve do you see that id in the url you sent? If you type your bot types :emojiname: it will send the emoji

#

really Discord? 🤦

#

wait

maiden mauve
#

lol

nocturne grove
#

:emojiname:

maiden mauve
#

So every custom png gets a snowflake?

nocturne grove
#

dlsa;fsdj;ofds;

#

yes every emoji

maiden mauve
#

:589203990483566592:

#

but when bot sends, it will work?

earnest phoenix
#

no

nocturne grove
#

okay, just let your bot write <:emojiname:589203990483566592>

#

yes it works now

earnest phoenix
#

custom emojis must be sent in a <:emoji:id> format

#

yes thaz

#

that

nocturne grove
#

the bot has to be in the server

maiden mauve
#

hm

#

that doesn't sound right

nocturne grove
#

what?

restive night
#

Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
how to fix this? I use djs v12

maiden mauve
#

oh I see what your saying

#

the bot has to be in the emoji discord

#

and anywhere else

#

☑️

#

thanks

nocturne grove
#

np

earnest phoenix
#

@restive night any err?

#

can i edit json file

#

like prefix: "/" and i will change it to prefix: "!"

nocturne grove
#

yes

#

but please don't use a json file as database, I did that and then spent even more time to convert it to a proper database

earnest phoenix
#

LoL

leaden flare
#

i have a quuestion

#

why tf my bot gets declined by having nsfw commands and theres a lot of bots that are nsfw on the page?

supple wedge
#

!help

earnest phoenix
#

Cuz the A lot of bot can use only in nsfw channel

wet dove
#

Please don't ask that in #development, but I think you mentioned NSFW, and might have nsfw command working in none nsfw channels. @leaden flare

gilded plankBOT
#

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

wet dove
#

Oh they left.

leaden flare
#

all my nsfw commands are only avaliable on nsfw channels

wet dove
#

Well you mentioned nsfw in the bot description.

#

Please move that conversation to #general

limber flume
#

hello

#

can someone help me

#

i cant find a coronavirus api

amber fractal
limber flume
#

thank you so much

#

wait

#

no

#

i need a counting thing

amber fractal
#

idk what "a counting thing" is

limber flume
#

like

#

.coronavirus

#

and the embed saus

#

3,0000 cases

#

deaths

#

and other

amber fractal
#

if it would embed

limber flume
#

erm?

#

i can make the embed

#

i just need link

mossy vine
#

man just google coronavirus api

limber flume
#

i did

#

i cant find nun 😭

mossy vine
#

mm yes none

limber flume
#

yeah i dunno how to use them:|

#

i need sum for python

mossy vine
#

you send http requests

#

you can use any http api in python

#

just send an http request

limber flume
#

i know

#

but can u help me to get a api

#

i can set

#

desc of embed

#

to be the api

mossy vine
#

google

limber flume
#
@bot.command()
async def corona(ctx):
    await ctx.message.delete()
    headers = {"Accept": "application/json"}
    async with aiohttp.ClientSession() as session:
        async with session.get("https://api.covid19api.com/summary", headers=headers) as req:
            r = await req.json()
    await ctx.send(r["TotalConfirmed"])
    await ctx.send(r["TotalDeaths"])
    await ctx.send(r["TotalRecovered"])
#

will this work?

opaque seal
limber flume
#

is it free?

earnest phoenix
#

what's the syntax error in this mysql call?

  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1",
  sqlState: '42000',
  index: 0,
  sql: 'SELECT * FROM timezones WHERE user_id = 165937223554826241)'
}
#

isn't this correct syntax?

cinder patio
#

I mean you have a random ) at the end

limber flume
#
seañToday at 14:41
@bot.command()
async def corona(ctx):
    await ctx.message.delete()
    headers = {"Accept": "application/json"}
    async with aiohttp.ClientSession() as session:
        async with session.get("https://api.covid19api.com/summary", headers=headers) as req:
            r = await req.json()
    await ctx.send(r["TotalConfirmed"])
    await ctx.send(r["TotalDeaths"])
    await ctx.send(r["TotalRecovered"])
#

can someone

#

confirm this will work?

#

or am i dumb

earnest phoenix
#

oh right

#

how i can restart the bot ??

#

oh nvm

sudden geyser
#

sean I don't know much python but the scope of r doesn't look like it's accessible

slender thistle
#

@limber flume TIAS

#

Try It And See

opaque seal
limber flume
#

nope

#

eroors everywhere

#

error**

hasty sparrow
#

Define big

slender thistle
#

Well... what are the errors?

limber flume
#

i cant its jsut

#

i cant

slender thistle
limber flume
#

i have tried and i just cant do 1 simple

#

command

earnest phoenix
#

No it is not wotking

#

help me

#

how to restart bot

hasty lotus
#

hey

earnest phoenix
#

i used bot.destroy() but not working

hasty lotus
#

is there any way to check if the message author has voted in the past 12 hours ?

earnest phoenix
#

@hasty lotus if u console.log u can loook at log

#

or u have to make ur bot dm you

hasty lotus
#

nah i want to di it automatically

#

like for a command

earnest phoenix
#

maybe not

hasty lotus
#

a kind of "premium" command

#

that are only available when you voted

earnest phoenix
#

or if anyone vote

hasty lotus
#

:/

earnest phoenix
#

it will write it to json file

#

and then with command you read the json file

hasty lotus
#

i tried this :

dbl.hasVoted(message.author.id).then(voted => {
    if (voted) {
      //command script
    }
});```
#

it's the example on the dbl api doc

#

but it runs anyway

#

even if you haven't voted

#

😐

earnest phoenix
#

check this

#

when someone vote it will write to json file, and then you can simple with one command to read json file

#

Now pls help

#

How i can restart the bot

#

i tried bot.destroy() but not working

hasty lotus
#

you can use client.destroy() function

earnest phoenix
#

yes but not working

hasty lotus
#

but it will stop the bot

#

it will just stop it

#

not restart it

#

there isn't any way of making a command that stops the process and restarts your index

#

and thank you i know what is json

hasty sparrow
#

You could use a process manager to restart the bot automatically when it's shut down

hasty lotus
#

but i don't want to do a db

#

you can use pm2

#

or forever

earnest phoenix
#

with process.exit(1) ??

hasty lotus
#

forever start index.js

earnest phoenix
#

nah

#

wait what

#

how i can execute that command

hasty lotus
#

in the bot ?

#

you can't

#

you can't make a command that restarts the index

earnest phoenix
#

oof

#

so how i can change the prefix

#

cuz when i changed the prefix but bot still running with old prefix

hasty lotus
#

restart your process

#

🤷‍♂️

earnest phoenix
#

with ?

hasty lotus
#

idk

earnest phoenix
#

process.exit(1) ??

hasty lotus
#

nah

#

is it on a vps ?

#

just login on it with ssh

#

open the screen

earnest phoenix
#

yes but i am testing on my local

hasty lotus
#

ok don't ligin then

#

just go on your terminal page

#

do ctrl + c

earnest phoenix
#

aha

hasty lotus
#

and the node index.js

earnest phoenix
#

bruh I want to do it automaticly

#

omg

hasty lotus
#

you can't

#

just don't try

#

it's not possible

earnest phoenix
#

but i saw someone try it ?

hasty lotus
#

then it's not a full restart

#

to stop the process you have to stop running your index

#

but if your index stops

#

then it can't run anything

#

so it can't run a command to restart itself

earnest phoenix
#

ok

hasty lotus
#

the index is a bit like the heart of your code

#

if you remove the heart

#

it dies

#

and i can't make anything to save himself

restive night
#

how to load command to all shard?

earnest phoenix
#

no

#

i wanted to change bot prefix with command

#

@flat pelican pandasad

#

but it still with old prefix

#

so i need to reload the bot

hasty lotus
#

@earnest phoenix

#

you can do something

#

like that reads a json file

#

like do a config file

#

and at every message var { prefix } = require("./config.json")

earnest phoenix
#

i have done same thing

#

so i saved prefix data to json file

#

and then i use comamnd to edit the prefix value

hasty lotus
#

ok send your index

earnest phoenix
#

but i need to restart the bot

hasty lotus
#

send your index

#

do you have a cmd handler ?

#

and send your prefix changer command too

earnest phoenix
#

yes

rapid aurora
#

#credits

hasty lotus
#

?

#

#credits
@AYOUBxKILLER#2804 ?

#

wtf

#

he left

#

ok

#

xD

earnest phoenix
#

Bruh not working

#

:((

limber flume
#

i done this because im a noob

#

😦 i couldnt get apis working

hasty sparrow
#

Typo in "Corna Virus"

turbid wharf
#

xd

#

Corona Virus

earnest phoenix
#

oh wait

limber flume
#

sorry

#

oh yeah

#

let me fix that

#

lol

rich coral
#

How do I learn JavaScript

earnest phoenix
#

umm.. google?

rich coral
#

I thought there were websites

mossy vine
#

there are

rich coral
#

Which is...

#

?

mossy vine
#

google

earnest phoenix
#

lol

rich coral
#

Do You have to pay for them

pale vessel
#

nope

celest shard
#

I don't know, why don't you check them out by clicking them.

pale vessel
#

imagine having to pay for javascript lesson

celest shard
#

xdd

heavy marsh
#

Can someone help on my db = mongooes
Using discord.js v12

//Conneting To Voice Channels
manager.on("shardCreate", shard => {
shard.on("ready", async() => {
if(shard.id === manager.totalShards - 1) {

const db = mongoose.connection.collection('server');
db.find({ voiceID: { $ne: undefined }}, (err, doc) => {
if (err) return console.error(err);

doc.toArray((err, docs) => {
if (err) return console.error(err);

docs.map(d => shard.channels.cache.get(`${d.voiceID}`)).filter(Boolean).forEach(c => {
  c.join();
 });
});

console.log(`[ Bot Joined Voice Channels ] Bot joined ${doc.voiceID.length}`);
});
};
});
});
#

The bot doesnt connected to the voice channel

sudden geyser
#

imagine having to pay for javascript lesson
sounds like java

#

@heavy marsh are you sure shard.channels is a property.

heavy marsh
#

I dont get any errors

nocturne grove
#

Hey, I'm about to change my code a bit so I will do con.connect() and con.disconnect() with every query I'm executing on my mysql database, as some here said that's preferable. Is that right?

pale vessel
#

yeah

heavy marsh
pale vessel
#

what version of discord.js

restive furnace
#

this is kinda off-topic: but wheres cold flazepe?

pale vessel
#

gone

restive furnace
#

r.i.p

nocturne grove
#

yeah
@pale vessel I guess you said that too the other time, but I believe you xd

heavy marsh
#

what version of discord.js
v12.2.0

pale vessel
#

like kinolite said, are you sure shard.channels is a thing?

cinder patio
#
#

Shard !== Client

heavy marsh
#

Then how can we get the channels?

#

What I am trying to do is make the bot join the voice channels as all the shards are connected

cinder patio
honest perch
#

@limber flume are you using js or py?

heavy marsh
#

shard.eval()

earnest phoenix
#

How i send a message in java?

mossy vine
honest perch
#

^

limber flume
#

python

honest perch
#

ahh, idk any python so i cant really help you with that

limber flume
#

damn

#

to like support server

#

scltxnToday at 17:58
guys im wanting to add premium commands to my bot what should i give it

#

i think

#

maybie

astral yoke
#

you caught me

limber flume
#

xD

#

i can see deleted messeges

#

xD

astral yoke
#

let me guess

#

its a plugin?

limber flume
#

yes sir

#

ight

#

i got u

#

u got better discord?

astral yoke
#

ofc

tight plinth
#

I'm searching a js api that triggers a event if a google forms gets a new response, but I cant find anything. do u guys know smth to do that?

raven urchin
#
    console.log("Channel with ID: " + channel.id + " was just created");
});```
So I want to send this to my channel ID, how can I do that?
tight plinth
#

my channel ID
wdym

raven urchin
#

So I want it to send to the specific channel

tight plinth
#

client.channels.cache.get("channelID").send('...')

raven urchin
#

Is that for v11?

tight plinth
#

for v11 remove .cache

raven urchin
#

Alright, thanks again :)

tight plinth
#

np

heavy marsh
#
//Conneting To Voice Channels
manager.on('shardCreate', (shard) => {
  shard.on('ready', async () => {
    if (shard.id === manager.totalShards - 1) {
      const db = mongoose.connection.collection('server');
      db.find({ voiceID: { $ne: undefined } }, (err, doc) => {
        if (err) return console.error(err);

        doc.toArray((err, docs) => {
          if (err) return console.error(err);
console.log(docs);
          docs
            .filter((d) => d.voiceID)
            .map((d) => {
              shard.eval(
                `let channel = this.channels.cache.get('${d.voiceID}');
  if (channel) channel.join().catch(() => {})`
              );
              console.log(
                `[ Bot Joined Voice Channels ] Bot joined ${d.voiceID}`
              );
            });
        });
      });
    }
  });
});

Can anyone help me out - PLease

#

I am trying to connect my bot to stored voice channels after all shards are online

tight plinth
#

error?

heavy marsh
#

no error

tight plinth
#

just

#

why

heavy marsh
#

And bot joins 0 channels

#

What do you mean just why? 👀

tight plinth
#

why would you do this

#

I dotn get the point

heavy marsh
#

Cause my bot is a music bot and I want the bot to reconnect to the voice channels after the bot goes offline & back online

tight plinth
#

if the bot gets offline it doesnt disconnect to the vc until discord automaticly does it after ~5-10 min

#

except if you write some script to do that

heavy marsh
#

But it will stop playing music

tight plinth
#

yes of course

#

people just have to redo the play command

heavy marsh
#

Yep but I am trying my best to keep the bot on the vc

tight plinth
#

it stays on the vc

heavy marsh
#

...

tight plinth
#

even if it stops playing music

heavy marsh
#

No I mean I am trying to make the bot stay & play the music it was playing

tight plinth
#

u cant

earnest phoenix
#

For() is running one time and stop

#

request(options, function (error, response) {
if (error) throw message.channel.send(err);
let data = JSON.parse(response.body);
for(var i = 0 ;i < 200 ; i++)
{
if(data.Countries[i].CountryCode == code)
{
let embed = new Discord.RichEmbed()
.setColor(color.orange)
.setTitle(**${data.Countries[i].Country}**)
.addField("Country Code", data.Countries[i].CountryCode, true)
.addField("Slug", data.Countries[i].Slug, true)
.addField("New Confirmed", data.Countries[i].NewConfirmed, true)
.addField("Total Confirmed", data.Countries[i].TotalConfirmed, true)
.addField("NewDeaths", data.Countries[i].TotalDeaths, true)
.addField("NewRecovered", data.Countries[i].NewRecovered, true)
.addField("Total Recovered", data.Countries[i].TotalRecovered, true)
.addField("Last Update", data.Countries[i].Date, true)
message.channel.send(embed);
break;
}
}
});

tight plinth
#

break

earnest phoenix
#

?

tight plinth
#

break stops the for loop smh

earnest phoenix
#

oh

tight plinth
#

and excuse me but why you want to send 200 messages?

earnest phoenix
#

No

#

I am searching for Country Code

tight plinth
#

oh

earnest phoenix
#

cuz i am using Corona Virus api

tight plinth
#

am blind

earnest phoenix
#

but it says US is not a country Code

#

helppp