#development

1 messages ยท Page 834 of 1

golden condor
#

server.get().suggestions.channel?

earnest phoenix
#

^, i told you to recheck your syntax

#

cxllm, you're most likely looking for ===

golden condor
#

I think I've fixed it

earnest phoenix
#

if the error still occurs, there's a mistake in your code somewhere which lets dms through when they shouldn't

storm bluff
#

thanks @golden condor

#

fix it

earnest phoenix
#

also it's bad practice to send messages on commands in dms (if you do not allow them), best is to not respond at all

golden condor
#

Iok

earnest phoenix
#

it's because you waste a request and uselessly add to the global message ratelimit

pale vessel
#

all right

#

i'll consider removing it

#

no, I will

#

come on freestyle

restive furnace
#

Is it possible to change your bot platform to mobile, so far i tried this: ready event: js client.on("ready", () => { client.user.presence.clientStatus.web = client.user.presence.clientStatus.mobile; }); and error: https://hastebin.com/ukatanolut.coffeescript

earnest phoenix
#

i-

#

my dude you can't do that

pale vessel
#

and why

earnest phoenix
#

everytime you want to change something on discord you need to call a method because you need to make a request

pale vessel
#

this is equivalent to making your bot invisible

earnest phoenix
#

uh

#

no?

pale vessel
#

I mean it's useless

earnest phoenix
#

ah

#

i mean it's just for the aesthetics

restive furnace
#

okay, then. thanks anyway

heavy marsh
#
let LastMessage = member.user.lastMessage;
if (LastMessage > 5) LastMessage = LastMessage.substring(0, 5) + ' ...';

It says substring is not a function

pale vessel
#

because last message is not a string

#

you need to get the content

heavy marsh
#

let LastMessage = member.user.lastMessage.content;

pale vessel
royal portal
#

t r y i t a n d s e e

narrow kettle
#

how dare you tell me to try stuff my self

zenith terrace
#

Lol I like that video

storm bluff
#

-__->

#

help

earnest phoenix
#

you have eyes, read the error

#

stop making up your own functions and read the docs

celest viper
#

@weak parrot recently you kicked my bot for this : image come after, can you unkick it

#

I fixed this

earnest phoenix
#

there's no such thing as unkicking lmao

celest viper
#

a

weak parrot
#

Okay

#

But why post this in development?

celest viper
#

don't know think it's my favorite channel

#

thank's @shadow shale try to do better

#

Ps. I'm his creator

shadow shale
#

Do u use

#

Embeds

celest viper
#

๐Ÿคฆโ€โ™‚๏ธ

weak parrot
#

Keep in mind that this channel is solely for development related things please move the off-topic shit to off-topic

shadow shale
#

Um

celest viper
#

k

shadow shale
#

K

zenith terrace
#

K

regal saddle
#

K

celest viper
#

K

slender thistle
#

Why

#

Do you see what channel this is

regal saddle
celest viper
#

K

heavy marsh
#
let NickName = member.nickname;
if(!NickName) NickName = "None";

Still comes as undefined

summer torrent
#
if (Nickname === null) Nickname = "None";```
quartz kindle
#

that wouldnt make any difference

heavy marsh
#

...

earnest phoenix
#

:v

heavy marsh
#

yes cause when its null it works on one server... not the other
If its undefined it works on one not the other server

restive furnace
#

member.nickname ? "none"

#

member.nickname : member.nickname ? "none"

sudden geyser
#

Second one is bad syntax

earnest phoenix
#

it isn't

#

nvm

#

it is

#

director, are you sure you're actually using the NickName variable

heavy marsh
#

yep

#
let NickName = member.nickname;
if(!NickName) NickName = "None";
#

Is this wrong?

pale vessel
#

no

raven urchin
#

Why does my memory Usage show NaN?

sudden geyser
#

how are you calculating it

raven urchin
#

${(process.memoryUsage().heapUsage / 1024 / 1024/.toFixed(2)}

sudden geyser
#

you sure you aren't getting a syntax error

raven urchin
#

I'm sure

#

It just shows NaN

heavy marsh
summer torrent
#

${(process.memoryUsage().heapUsage / 1024 / 1024/.toFixed(2)}
@raven urchin missing )

sudden geyser
#

There are two type of props that start with "heap" for memeoryUsage:

{
  heapTotal: 114884608,
  heapUsed: 103758256
}

heapUsage is not a property.

raven urchin
#

How can i fix it?

lyric mountain
#

are you dividing by zero?

#

show us the section where you define that field

raven urchin
#

I'm not too sure where to find it. I'm still kinda new to discord.js

lyric mountain
#

...how do you created that embed?

sudden geyser
raven urchin
earnest phoenix
#

you got told what the problem is

quartz kindle
#

If you want an accurate reading, use rss not heapUsed

raven urchin
#

Ok it's working. Thank you very much!

lyric mountain
#

don't forget to add the units in front of it

raven urchin
#

Wdym units?

lyric mountain
#

KBs, MBs, GBs, etc

quartz kindle
#

MB / MegaBytes

raven urchin
#

Ah yes ok

cinder jetty
#

anyone know how to implement playlist feature to music bot without the youtube api? ping me or dm me if u know how to โค๏ธ

lyric mountain
#

without the youtube api you'll not be able to search for playlists/musics

cinder jetty
#

im using yt-search

#

and it works with links and searching

blissful scaffold
#

Put all the songs that need to be played in a list

cinder jetty
#

@blissful scaffold right but how do you get each song from a playlist when its a link

#

you cant just loop over the url thats what im trying to work around

#

im using yt-search, but that doesn't seem to work for playlists even though it should

blissful scaffold
#

Not a youtube playlist, use a js list

quartz kindle
#

Why without the youtube api? Doesnt ytsearch use the youtube api anyway?

raven urchin
#

So i just added MBs and it doesn't respond at all

blissful scaffold
#

When a song is finished load the next URL in the list

raven urchin
cinder jetty
#

@quartz kindle using the youtube api means if u go over the daily quota it doesn't work anymore

#

hence why I switched to yt-search

quartz kindle
#

You cant do "a" "b" lol

cinder jetty
#

for some reason the daily quota was met after like 1 hour of testing

#

which isn't good

quartz kindle
#

Either do "ab" or "a"+" b" @raven urchin

cinder jetty
#

@blissful scaffold im trying to implement so that if a user enters a playlist link, it will play it and queue all the songs up so idk what u mean

raven urchin
#

I'm so stupid, thank you again.

cinder jetty
#

anyone know any decent c# hosting platforms?

#

im so tempted to just write this in c#

quartz kindle
#

Well, the correct way to do that would be to increase your quota

#

Other than that, only via scrapping

cinder jetty
#

yeah but you need a company, website etc etc

#

whats scrapping oop

quartz kindle
#

Downloading the page and extracting links from it

cinder jetty
#

oh

#

right

quartz kindle
#

But its not gonna be easy since yt uses a lot of ajax

#

And lazy loading

cinder jetty
#

sighs

#

it's impossible to increase ur quota unless ur an actual business though

quartz kindle
#

Do they require an actual business registration number?

#

And tax id, etc?

earnest phoenix
#

anyone know any decent c# hosting platforms?
literally anything

#

if you're using .net core you can run on any platform

summer torrent
#

show code

celest viper
#

just the embed code

zenith terrace
#

What version?

#

Plus you forgot the () at the end of Embed

regal saddle
#

RichEmbed = MessageEmbed in V12

zenith terrace
#

Message

#

not Messages

regal saddle
#

oh

zenith terrace
#

๐Ÿ‘€

regal saddle
#

ye

celest viper
#

yeah cause you forgot your () you f*** all @earnest phoenix

#

at the end on RichEmbed

regal saddle
#

imagine being that toxic xD

celest viper
#

ouh

zenith terrace
#

Yes

royal portal
#

How do you make a bot reload every 10 minutes in Discord.js?

regal saddle
#

Didnt Night already said that?

zenith terrace
#

Yes

#

I did

heavy marsh
#
bot.on("guildCreate", guild => {

bot.channels.cache.get(`688812916639924286`).send(`![add](https://cdn.discordapp.com/emojis/686327914488135805.webp?size=128 "add") Joined guild **${guild.name} [ ${guild.id} ]** \`[ Now connected to ${bot.guilds.cache.size} servers ]\``);
console.log(`[ Guild Join ] ${guild.name} (${guild.id})`);

});

Why it it coming as undefined?

regal saddle
#

How do you make a bot reload every 10 minutes in Discord.js?
Why would you?

celest viper
#

๐Ÿคฆโ€โ™‚๏ธ

zenith terrace
#

Which part @heavy marsh

royal portal
#

@regal saddle Because my bot status stops working after 20 minutes

heavy marsh
#
[ Now connected to ${bot.guilds.cache.size} servers ]\``);
celest viper
#

I will dm @earnest phoenix

regal saddle
#

tag angeryBOYE

earnest phoenix
#

have you thought about maybe... resolving the issue that makes your bot crash every 20 minutes instead of putting a band aid on it

royal portal
#

no

#

I don't see any errors

earnest phoenix
#

because you don't handle them properly

celest viper
#

@royal portal don't host your bot on a rpi 3

royal portal
#

why?

#

Where should I host it on?

celest viper
#

it goes on sleep mode and the bot stop working

royal portal
#

I turned that off

#

My bot still works its just the status stops

celest viper
royal portal
#

Thats why I want to have a bot that refreshes every 10 minutes

celest viper
#

why

royal portal
#

The status works on older versions

#

The newer version of node.js and discord.js is just breaking it

zenith terrace
#

@heavy marsh send pic of ur code

celest viper
heavy marsh
zenith terrace
#

Wait why is it like ${bot
.guilds.cache.size}

#

Or is it because the software you used ran out of lines?

heavy marsh
#

nope

#

its cause of the sape

#

space*

zenith terrace
#

Oh ok

crimson vapor
#

neehsi what language and library?

heavy marsh
#

By the way I am using v12.0.2

crimson vapor
#

discord js?

summer torrent
#

client.guilds.cache.size

zenith terrace
#

Gimme moment

crimson vapor
#

its client.guilds.cache.size or client.guilds.size

zenith terrace
#

@crimson vapor v12 so .cache

summer torrent
#

what is your djs version

crimson vapor
#

ok

summer torrent
#

client.guilds.cache.size

summer acorn
#

Any idea why MongoDB sets the 2 last digits in a Discord Server and Channel ID to 00?

late hill
#

Yes, you're using a data type that doesn't support numbers that high

#

Use strings for ids

heavy marsh
#
bot.channels.cache.get(`688812916639924286`).send(`![add](https://cdn.discordapp.com/emojis/686327914488135805.webp?size=128 "add") Joined guild **${guild.name} [ ${guild.id} ]** \`[ Now connected to ${this.bot.guilds.cache.size} servers ]\``);

Is it like this?

summer acorn
#

Oh, alright.

#

Thank you

crimson vapor
#

it doesnt

earnest phoenix
#

does mongo not have unsigned int64s?

crimson vapor
#

I had to use strings

late hill
#

I think the issue actually is that js (which is likely what they're using) just has Numbers

zenith terrace
#

Hmm

late hill
#

And js will just round those numbers so they are no longer accurate

crimson vapor
#

oh yeah

#

making it a string makes it work

heavy marsh
#
bot.on("guildCreate", guild => {

bot.channels.cache.get(`688812916639924286`).send(`![add](https://cdn.discordapp.com/emojis/686327914488135805.webp?size=128 "add") Joined guild **${guild.name} [ ${guild.id} ]** \`[ Now connected to ${bot.guilds.cache.size} servers ]\``);
console.log(`[ Guild Join ] ${guild.name} (${guild.id})`);

});
#

How to fix this ...

zenith terrace
#

@heavy marsh Unless u make it as an embed. I find them a lot easier

heavy marsh
#
 \`[ Now connected to ${bot.guilds.cache.size} servers ]\``);

Gives me [ Now connected to undefined servers ]

zenith terrace
#

One moment

heavy marsh
#

bot.on("guildCreate", guild => {

bot.channels.cache.get(688812916639924286).send(![add](https://cdn.discordapp.com/emojis/686327914488135805.webp?size=128 "add") Joined guild **${guild.name} [ ${guild.id} ]** \[ Now connected to ${bot.guilds.cache.size} servers ]`); console.log([ Guild Join ] ${guild.name} (${guild.id})`);

});

earnest phoenix
#

do that on ready

#

GUILD_CREATE gets sent out before ready too

heavy marsh
#

I want it to send when the bot joins a server

earnest phoenix
#

then don't do anything in guildCreate until ready is fired

heavy marsh
#

But it worked on v11

earnest phoenix
#

ok

zenith terrace
#

Ima try it on my bot

storm bluff
#

-)0

crimson vapor
#

isnt there a bot ready timsetamp

storm bluff
#

what's problem

earnest phoenix
#

you tell me

crimson vapor
#

I dont know what is your problem with the code

earnest phoenix
#

learn to debug your own code

#

it's your code

#

not ours

grizzled raven
#

just give the client a isReady prop set to false and set it to true on ready

earnest phoenix
#

can someone help me with a code?

tight plinth
earnest phoenix
#

?

#

Can someone help me with a code

marble juniper
#

do you need help because you have an error or is it just because you want someone else to code something for you @earnest phoenix

earnest phoenix
#

and i want to know how i can do it that when the persons join he auto-execute he

#

it was because idk how to do it on join that execute he his message

crimson vapor
#

use a reduce function on client.guilds.cache

earnest phoenix
#

and i cant use that

#

client.on('guildMemberAdd', member => {

#

because in start i use this

#

module.exports.run = async (bot, message, args) => {

#

that the command work when a person join

marble juniper
#

what command

earnest phoenix
#

yep

#

but i cant use module.exports.run = async (bot, message, args) => {

marble juniper
#

yes you can't

#

you need to use events

earnest phoenix
#

how i can do it?

marble juniper
#

not commands

tight plinth
#

quick question : ```py
import discord
from discord.ext import commands
client = commands.Bot("py-")

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

@client.command()
async def ping(ctx):
await ctx.send("Pong")

@client.command()
async def pong(ctx):
await ctx.send('ping')

@client.command()
async def say(ctx, *, arg):
await ctx.send(arg)

@client.command()
async def add(ctx, arg1 :int, arg2 :int):
await ctx.send(arg1+arg2)

client.run('mah token')```
if I try to add a help command it says there is aleready a help command

modest maple
#

you need to unload the inbuilt help command first

earnest phoenix
#

wow

tight plinth
#

question : how

earnest phoenix
#

how i do a event, im looking in the documentation

modest maple
#

i cant remember

earnest phoenix
marble juniper
#

um

#

no

#

with that I mean

earnest phoenix
#

ok

marble juniper
#

client.on('event'

earnest phoenix
#

ok

marble juniper
#

and so on

earnest phoenix
#

something like this?

marble juniper
#

yes

earnest phoenix
#

thanks

#

๐Ÿ™‚

#

it says me this

#

i change all member to user?

#

ok

elder garnet
#

how do i check if someone voted for my bot in top.gg ? (discord.js)

earnest phoenix
#

Why message.member ?? Use message.author no?

crimson vapor
#

message.member is a guild member

sudden geyser
#

guild members are not the same as users

crimson vapor
#

message.author is a message author

earnest phoenix
#

Oh yes sorry x)

#

i try the command

#

at this moment he dont say error in console

summer torrent
elder garnet
#

okay

earnest phoenix
#

nope

#

it dont say nothing

#

and nothing in the console

sudden geyser
#

I think you mean to check if anyone was mentioned first, else default to the author.

earnest phoenix
#

how i fix it?

sudden geyser
#

fix what exactly

earnest phoenix
#

ok

#

the name of the bot?

#

client

#

ok

#

i change everything user to client?

#

and what i change?

#

ok

#

it dont send nothing

#

yep

sudden geyser
#

is user a User or GuildMember? What version of Discord.js are you using?

earnest phoenix
#

dont work

#

11.6

sudden geyser
#

what is user supposed to be

earnest phoenix
#

kinolite you know?

#

the bot

sudden geyser
#

can you show where you defined it

earnest phoenix
#

a, sorry, the user is the message of the user

sudden geyser
#

message.user is not a thing.

#

and that's not the bot

raven urchin
#

I need some guides. How can I make it where if my bot joins it'll send a join message?

sudden geyser
#

skies, what library?

earnest phoenix
#

we are working on it

raven urchin
#

discord.js

sudden geyser
#

listen to the guildCreate event. check the docs

raven urchin
#

On google?

sudden geyser
#
raven urchin
#

Ohh ok, thx

earnest phoenix
sudden geyser
#

Grayald where did you even define message I see where.

earnest phoenix
#

xdd

#

you now what is wrong?

sudden geyser
#

Though I still don't get it. The screenshot you showed is a different file than the file you attached called Message.txt. If you're trying to find a channel in the current guild where the bot joined, you should be looking at message.guild.channels.find(...)

raven urchin
#

Ok so I found one. But idk if it'll work for my handler

sudden geyser
#

You should also fix message.user as that's not a thing. Check the docs.

earnest phoenix
#

message.user isn`t a thing?

sudden geyser
#

is that a command file

#

negative

earnest phoenix
#

yep

raven urchin
#

I found one on GitHub

sudden geyser
#

then why are you adding a new listener for every time the command is run?

earnest phoenix
#

because i run the command file with this

quartz kindle
#

thats a horrible idea

#

here's what happens when you do that:

raven urchin
#

My handler is like this

module.exports = {
name:"",
description:"",
execute: async (client, msg) so on

sudden geyser
#

You're just asking for a memory leak.

raven urchin
#

@earnest phoenix Mine does too

crimson vapor
#

wait why cant you do commands like that?

earnest phoenix
#

idk

sudden geyser
#

Put your new listeners in their correct location in your code. Not in a file like that, as you add a new listener for every time that happens. You may want to go over your code over again.

earnest phoenix
#

i do music and all

#

and i need to do the code again

#

??

quartz kindle
#

if you put event listeners in command files, here's what happens:

bot receives command
command creates listener
command runs

bot receives another command
command creates listener (now you have 2 listeners)
command runs twice

bot receives another command
command creates listener (now you have 3 listeners)
command runs three times

#

yes

earnest phoenix
#

F

quartz kindle
#

use the guildCreate event, find the first channel where your bot has permissions to send, send to that channel

unborn steeple
#

Im using discord.js but i cant firgure out how to create a category and then create a channel and assign that channel to the created category

quartz kindle
#

what have you tried?

unborn steeple
#

All kinds of stuff lol

crimson vapor
#

he means code

unborn steeple
#

Ohh hold on

wicked pivot
#

how we make the list of members with a pseudo example !ban tony, list members with tony in their username

crimson vapor
#

umm

#

message.guild.members.cache.find(m => m.tag.username.includes('tony'))

#

wait

#

no that is just one

pale vessel
#

filter.

crimson vapor
#

^

#

I couldnt remember it for a sec

unborn steeple
#
guild.createChannel('test', { type: 'category'}.then(guild.createChannel('test', { type: 'text'}))
wicked pivot
#

in ^11.4.2 srry

unborn steeple
#

Thats basically what i did

crimson vapor
#

ok so you created a category and a text channel

#

but you didn't assign the channel to the category

pale vessel
quartz kindle
#

@unborn steeple ```js
...createChannel(...).then(newchannel => {
// newchannel is the newly created category channel. create a new channel and set the category channel as parent
...createChannel("name",{parent:newchannel})
})

#

@wicked pivot to find members by name, including offline members, you need to use fetchMembers (in v11)

wicked pivot
#

okay, but rightly i've never done this so i don't know how to start.

quartz kindle
#

when you receive a message, get the guild from the message, use guild.fetchMembers() according to the docs link above

crimson vapor
#

fetchMembers returns a promise so you either need to assign a variable to await ...fetchMembers() or use .then

wicked pivot
#

I start from a good base or not?

earnest phoenix
#

@sudden geyser and i cant use this?

#

client.emit('guildMemberAdd', message.member)

sudden geyser
earnest phoenix
#

i know

#

v12?

sudden geyser
#

so if any user joins any guild, it'll emit for all your listeners. You only need 1 listener.

earnest phoenix
#

but i now change 20 commands?

sudden geyser
#

probably

earnest phoenix
#

feels bad

#

๐Ÿ˜ฆ

#

๐Ÿ˜ข

#

I had to figure channel creation out but in v12 d.js

#

its hell

crimson vapor
#

its easier tbh

#

channels.create iirc

earnest phoenix
#

not when you just learned v12

crimson vapor
#

what do you mean

earnest phoenix
#
let new_channel = await message.guild.channels.create(`${message.author.username}-${quizcode}`, { topic: `Request Opened By: ${message.author.tag} | Request Opened On: ${moment(message.createdAt).format("LL")} | Request ID: ${quizcode}`, parent: "686315004210839725", permissionOverwrites: [{ id: message.author.id, allow: ['VIEW_CHANNEL', "SEND_MESSAGES", "READ_MESSAGE_HISTORY"] }] })
crimson vapor
#

v12 is actually so much easier

earnest phoenix
#

I never knew v12 I started on v11

crimson vapor
#

same

wicked pivot
#
let Users = message.guild.fetchMembers(args.join(" "), 100)``` but then? ![Detente_ref](https://cdn.discordapp.com/emojis/547849405210951708.webp?size=128 "Detente_ref")
earnest phoenix
#

?

#

hm

crimson vapor
#
let Users = await message.guild.fetchMembers(args.join(' '), 100)```
#

if you dont await, it will return a promise

marble juniper
#

if you don't want to use await you gotta use .then

crimson vapor
#

^

earnest phoenix
#

^

restive furnace
#

^

marble juniper
#

I suggest using await anyways as it makes the code not so long

crimson vapor
#

is there a performance delay?

earnest phoenix
#

lol I have about 600 if statements in one command

crimson vapor
#

I try to keep it lower than 10 per

marble juniper
#
const object = example().then(variable => )
const object2 = await example()
#

le basics

quartz kindle
#

@earnest phoenix the correct way to use listeners is like this: ```js
// mainfile.js

client.on("message", message => {
// process command 1
// process command 2
// process command 3
// etc
});```

#

the listener should be used only once, in your main file.

#

then inside the listener you should check the message content, what command was run, and fire the relevant command or/or command file

marble juniper
#

also check for prefix (part of the command stuff) and if the user is a bot

earnest phoenix
#

ok

marble juniper
#

also if the message comes from a server

crimson vapor
#

is it a bad idea to have multiple listeners?

earnest phoenix
#

yes

#

wasting memory

quartz kindle
#

and cpu

crimson vapor
#

I should change my bot then lol

marble juniper
#

you don't really need multiple listeners anyways there is no reason

crimson vapor
#

well I have one for commands and one for handling xp

pale vessel
#

combine them

crimson vapor
#

I am now

quartz kindle
#

fuuuuuuusion

sudden geyser
#

haaa!

crimson vapor
#

lmao I actually have 3

marble juniper
#

if you don't declare variables twice then copy pasting should be enough

crimson vapor
#

another for loading data

marble juniper
#

its time for another fusion

crimson vapor
#

how should I do this

#

because it returns

#

just remove return and use break?

marble juniper
#

then

#

don't make them return after it completed it's task

crimson vapor
#

got it

marble juniper
#

brain pls think

crimson vapor
#

let thought = new Thought('how').question()

#

I mean on the thinking part

#

I have an idea on the combining

marble juniper
#
let brain = require("iq")
crimson vapor
#

nah man

#

I dont have that installed

celest viper
#

const brain = require("iq")

#

better

#

const can't change

storm bluff
#

      const emoji = client.emojis.cache.get(args[0]) || message.guild.emojis.cache.find(emoji => emoji.name === args[0] ) || message.guild.emojis.cache.get(args[1])
          
      if (!emoji) return message.channel.send("Please mention emoji or put id")

      server.set(message.guild.id, emoji.id, "suggestions.turereact")

      message.channel.send(
        `Successfully setup true emoji to **${emoji.name}**`
      )
    }
#

help:>>

earnest phoenix
#

args[0] is both "setreacttrue" and the emoji

#

They need to be different in this scenario

storm bluff
#

@earnest phoenix Explain more

quartz kindle
#

@storm bluff default emojis are not stored in discord.js

#

only custom emojis are

storm bluff
#

discord emojis not work?

#

@quartz kindle

modest maple
#

@storm bluff default Emoji's are Unicode

earnest phoenix
royal portal
#

does this look ok

#

I can't get setActivity working

#

lol

modest maple
#

it looks offline :P

royal portal
#

yeah

#

It will be online later

#

I changed the token

#

.-.

marble juniper
#
function getAll(client, message) {
    const embed = new MessageEmbed()
        .setColor("RANDOM")

    const commands = (category) => {
        return client.commands
            .filter(cmd => cmd.category === category)
            .map(cmd => `\`${cmd.name}\``)
            .join(", ");
    }

    const info = client.categories
        .map(cat => stripIndents`**${cat[0].toUpperCase() + cat.slice(1)}** \n${commands(cat)}`)
        .reduce((string, category) => string + "\n" + category);

    return message.channel.send(embed.setDescription(info));
}
#

how can I make this ignore the category called owner?

earnest phoenix
#

if (category === owner) {
i dont know how to make an ignore function
}

#

also i see you're watching thesourcecode @marble juniper

marble juniper
#

y e s

earnest phoenix
#

me 2

earnest phoenix
#

how do you make that in lines

#

like

#

command list another command list

#

etc.

#

instead of

#

command list

another command list

#

Check if the message author and message mention are the same

#

basically yeah

marble juniper
#

now there is a gap

#

and idk how to remove that gap

blazing otter
#

am I super dumb or is there not a way to generate one-time invite links for a guild from the API?

#

Get Invites, Delete Invites

#

but I'm not seeing Create anywhere

grizzled raven
royal portal
#

guys]

#

does this look good enough

#

the name

#

(because setActivity works for like 20 mins dont ask why lol)

blazing otter
#

ah hah, it's under channels, gotta create a channel invite

gritty frost
#

I want the bot to disconnect automatically when there is no user in vc [music bot]

tight plinth
#

@gritty frost check number of users in vc

#

When it hits 0 disconnect

gritty frost
#

hm yup

#

no idk

royal portal
#

How to make a bot say their prefix and all that when they get invited to a server?

#

Like 'Thanks for adding the bot'

unique nimbus
#

js?

royal portal
#

yup

#

discord.js

summer torrent
#

listen guildCreate event

mystic violet
#

is it possible to use discord.js functions through player.voiceConnection...
so I can do something like
player.voiceConnection.play(ytdl()) for livestreams?
or is there a player.playStream()?
(For shoukaku)

royal portal
#

client.on("guildCreate", function(guild){
channel.send("Thanks for adding me.")
});

#

like that?

mystic violet
#

I asked in their community they didn't answer

summer torrent
#

client.on("guildCreate", function(guild){
channel.send("Thanks for adding me.")
});
@royal portal define channel

royal portal
#

so that will work?

golden condor
#

This error just suddenly happened

#

I don't know why]

#
events.js:180

    throw err; // Unhandled 'error' event

    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])

    at Client.emit (events.js:178:17)

    at WebSocketConnection.onError (/rbd/pnpm-volume/f1552016-7520-4cf1-aa54-a936a6ca55c3/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)

    at WebSocket.onError (/rbd/pnpm-volume/f1552016-7520-4cf1-aa54-a936a6ca55c3/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/event-target.js:128:16)

    at WebSocket.emit (events.js:189:13)

    at abortHandshake (/rbd/pnpm-volume/f1552016-7520-4cf1-aa54-a936a6ca55c3/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:718:15)

    at ClientRequest.req.on (/rbd/pnpm-volume/f1552016-7520-4cf1-aa54-a936a6ca55c3/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:595:7)

    at ClientRequest.emit (events.js:189:13)

    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)

    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)

    at TLSSocket.socketOnData (_http_client.js:442:20)

    at TLSSocket.emit (events.js:189:13)

    at addChunk (_stream_readable.js:284:12)

    at readableAddChunk (_stream_readable.js:265:11)

    at TLSSocket.Readable.push (_stream_readable.js:220:10)

    at TLSWrap.onStreamRead (internal/stream_base_commons.js:94:17)```
royal portal
#

@golden condor when did you update node.js or discord.js

golden condor
#

I didn't

dull terrace
#

I can't boot my bot, I have this error (in python) :

 File "stelybot.py", line 973, in <module>                                               |
    client.run(client.config_token)                                                       |
  File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 598, in run       |
    return future.result()                                                                |
  File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 579, in runner    |
    await self.start(*args, **kwargs)                                                     |
  File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 543, in start     |
    await self.connect(reconnect=reconnect)                                               |
  File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 457, in connect
    await self._connect()
  File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 418, in _connect
    self.ws = await asyncio.wait_for(coro, timeout=180.0, loop=self.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 244, in from_clie
nt
    await ws.poll_event()
  File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 469, in poll_even
t
    await self.received_message(msg)
  File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 370, in received_
message
    raise ResumeWebSocket(self.shard_id)
discord.gateway.ResumeWebSocket: None
golden condor
#

I don't understand the error I got

slender thistle
#

Sounds like Discord API issues

unique nimbus
#

yes

#

discord.gateway

#

I think Discord is dying inside

royal portal
#

@summer torrent like this?

#

client.on("guildCreate", function(guild){
bot.channel.send("Thanks for adding me.")
});

#

??

slender thistle
#

What would bot.channel be

royal portal
#

well

#

I wanted to make so

#

when you add the bot to your server

#

then it says Thanks for adding me

#

something like that

slender thistle
#

And where are you going to send the message

golden condor
#

Yeah seems weird that two people get the same error on two different language

royal portal
#

in general

slender thistle
#

search for a channel named general then

royal portal
#

.-.

slender thistle
#

or use the guild's system channel

royal portal
#

idk how

golden condor
#

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])

#

AAAAA

dull terrace
#

What do I have to do to fix the mistake?

golden condor
#

Apparently it's a discord api issue

slender thistle
#

Unless you work at Discord, you can't fix something that's server-side

golden condor
#

Me and you had the same error in two different coding languages

finite bough
golden condor
#

BRUH

unique nimbus
#

Error 520 is essentially a catch-all response when something unexpected happens or when the origin server incorrectly interprets or does not tolerate a request due to a protocol violation or an empty response.

golden condor
#

READ ABOVE

dull terrace
#

@slender thistle I have to wait?

unique nimbus
#

Discord is dying atm

golden condor
#

yes

royal portal
#

client.on("guildCreate", function(guild){
bot.channels.get("#general").send('Thanks for adding me')
});

#

howwww

unique nimbus
#

We ain't spoonfeeding

slender thistle
#

If you have other more important things to do, go finish them. Might as well come back to a lively API

golden condor
royal portal
#

no it gave me an error

small prairie
#
events.js:180
    throw err; // Unhandled 'error' event
    ^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
    at Client.emit (events.js:178:17)
    at WebSocketConnection.onError (/rbd/pnpm-volume/89f57bc8-9932-4d43-9864-f45b13c950de/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
    at WebSocket.onError (/rbd/pnpm-volume/89f57bc8-9932-4d43-9864-f45b13c950de/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/event-target.js:128:16)
    at WebSocket.emit (events.js:189:13)
    at abortHandshake (/rbd/pnpm-volume/89f57bc8-9932-4d43-9864-f45b13c950de/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:718:15)
    at ClientRequest.req.on (/rbd/pnpm-volume/89f57bc8-9932-4d43-9864-f45b13c950de/node_modules/.registry.npmjs.org/ws/6.2.1/node_modules/ws/lib/websocket.js:595:7)
    at ClientRequest.emit (events.js:189:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
    at TLSSocket.socketOnData (_http_client.js:442:20)
slender thistle
#

RTD NekoProud

golden condor
#

Read above

small prairie
#

Weird error

unique nimbus
#

Discords API is dying

golden condor
#

Discord api issues

small prairie
#

Ah Rip

#

Sad

finite bough
#

can someone check my error

golden condor
#

Everyone is getting i

#

@finite bough you have the same error as everyone else here

#

Atm

royal portal
#

client.on("guildCreate", function(guild){
bot.channels.get(general).send('Thanks for adding me')
});

#

that might work

golden condor
#

Read what we are saying

small prairie
#

Api got Corona?

finite bough
#

lel

golden condor
#

My bot is struggling

royal portal
#

client.on("guildCreate", guild => {
guild.owner.send('Thanks! You can use +help to discover commands.')
});

golden condor
#

It connected

#

Then died

small prairie
#

Seme

golden condor
#

Every single bot is slowly going down

small prairie
#

Sad AF

golden condor
small prairie
#

Corona Killed Api

#

Bots are users

royal portal
#

would this work

#

client.on("guildCreate", guild => {
guild.owner.send('Thanks! You can use +help to discover commands.')
});

golden condor
#

My bot came back online

shadow shale
#

Oof i waited 30 mins until this showed

small prairie
royal portal
#

?

#

i hate that site

pale vessel
#

because you don't try and see

royal portal
#

i did

unique nimbus
#

Maybe because you should try the code and see if it works bruh

royal portal
#

i got error

slender thistle
#

Sending a message to guild owner on bot invite isn't the smartest idea

small prairie
#

Coz API is Dead

#

^^^

royal portal
#

throw error

small prairie
#

Maybe owner didnt add the bot

pale vessel
#

my bot's running fine

small prairie
#

Some staff did

#

Or someone with manage guild perms

#

like anyone

slender thistle
#

As an average user I don't exactly care if you're grateful if I use the bot or not. I invite the bot to either try it out or use it on my server

golden condor
#

My bot is back

small prairie
#

Mine too!!

golden condor
small prairie
#

LMFAO

finite bough
#

@royal portal that code is correct

copper cradle
#

lmao

#

no it isn't

#

channel isn't even defined

pale vessel
#

general

#

oof

golden condor
small prairie
#

Lol Discord

royal portal
#

@finite bough ye it works now

small prairie
#

This must happen ater couple of weeks

#

after*

golden condor
small prairie
#

Lol

royal portal
#

@golden condor whats that app called

#

the corynth

small prairie
#

this big outage happened in december last time

royal portal
#

is that like the new gyazo

golden condor
#

?

pale vessel
#

sharex server

golden condor
#

Corynth is my bot lmfao

royal portal
#

o

small prairie
#

Thought so

royal portal
#

u paying for domain

#

a

pale vessel
#

no

golden condor
#

no

#

It's free

pale vessel
#

it's f r e e

royal portal
#

from where

golden condor
pale vessel
#

just open the domain smh

small prairie
#

i t ' s f r e e

golden condor
#

PewDiePie Tuber Simulator Intensifies

pale vessel
#

what?!!

golden condor
#

It's free, and that's a great price!

royal portal
#

wait how do you use it

#

i signed up

spice pier
#

Thanks for your password

royal portal
#

oh

#

where do i upload stuff

pale vessel
#

download sharex or any other software that supports it

royal portal
#

@spice pier wdym

pale vessel
wicked pivot
#
const search = ["discord.gg", "http", "www", "free", "FREE", "Free"].map( s => s.toLowerCase())
const members = message.guild.members.filter(member => !member.user.bot)
let FoundStatut = members.filter(m => search.filter(s => m.user.game && m.user.game.state.toLowerCase().includes(s).length > 0))```

TypeError: Cannot read property 'state' of undefined
spice pier
#

Thank you for giving me your password

pale vessel
#

user.game is undefined

royal portal
#

@spice pier i didnt

spice pier
royal portal
#

no

summer torrent
#

@wicked pivot

royal portal
#

i logged in

pale vessel
#

bcrypt btw

wicked pivot
#
m.user.presence.game```?
pale vessel
#

try it and see

summer torrent
#
let FoundStatut = members.filter(m => search.filter(s => m.user.game && m.user.game.state && m.user.game.state.toLowerCase().includes(s).length > 0))

filter members who has game.state

spice pier
#

I really thought i could play with this white name, sorry white name

pale vessel
#

being a bot developer doesn't make you special

summer torrent
#

also m.user.presence.game @wicked pivot

pale vessel
#
#

good site

wicked pivot
#

TypeError: Cannot read property 'toLowerCase' of null

pale vessel
#

because the user is not playing anything

golden condor
#

Hello

pale vessel
#

Hey

shadow shale
#

c-error 406

#

Do it

#

And see

golden condor
shadow shale
#

Ik

golden condor
#

Thanks for liking my bot ๐Ÿ˜‰

shadow shale
#

No problem

#

(:

golden condor
#

lmao

#

I like my bot too

wicked pivot
#

it does not work @summer torrent @pale vessel

pale vessel
#

don't ping two people

summer torrent
#

"user.presence.game"

#

not "user.game"

wicked pivot
summer torrent
#

๐Ÿ”ญ

wicked pivot
pale vessel
#

that's bots

#

!member.user.bot for members

wicked pivot
#

look at the first screen, my code to find all no bot members

late hill
#

He's trying to point out that the 2 numbers shown are the total member count

#

While they shouldn't

#

The issue, or at least one of the issues would be that the includes method returns true or false.
So you using a length property on that makes no sense?

wicked pivot
#

I used this for nicknames, is it works pretty well

#
let FoundUser = members.filter(m => search.filter(s => m.user.username.toLowerCase().includes(s) || m.nickname && m.nickname.toLowerCase().includes(s)).length > 0)```
late hill
#

that's different

#

Notice how there's 2 ))

#

You're no longer using .length on the result of the includes method.

wicked pivot
#

it works ! thank you i didn't notice this

marble juniper
#

how can I send a message to every channel in a guild
(using v11.5.1)

earnest phoenix
#

loop through the guild's text channels

hoary elm
#

^^

earnest phoenix
#

@marble juniper why u want To do this..?

marble juniper
#

just for fun in my private server

earnest phoenix
#

Don't make this

marble juniper
#

also I tried doing for each but that didn't work

earnest phoenix
#

This isn't allowed

#

U spam the api with this

marble juniper
#

I only do it once

#

and its like

#

2 channels

#

thats not much api spam

earnest phoenix
#

Mmmh...

#

Map the channels

#

And .send

marble juniper
#

k Imma try

#

like this or what

earnest phoenix
#

map wastes memory

#

loop through it

#

also the channels collection doesn't only contain text channels

#

U can:

#

message.guild.channels. forEach(c => {c.send("Yeet")})

marble juniper
#

the only channel it sent a message in was the first channel of the server

#

nice

earnest phoenix
#

can you read

#

also the channels collection doesn't only contain text channels

hoary elm
#

You gotta filter out the voice channels.

marble juniper
#

k

earnest phoenix
#

and categories, and news channels

hoary elm
#

Yup

marble juniper
#

oof

earnest phoenix
#

basically check if the type is text

marble juniper
#

yes

#

if (channel.type == 'text') channel.send("message")
else return

#

easy

copper cradle
#

well yes

#

but map wastes memory

#

just loop through it

gritty frost
#

how to check how many people in vc with bot

storm bluff
#

why i can't put emoji from discord only from server

grizzled raven
#

is forEach as good as for i in ...?

#

also how bad is map

slender thistle
#

forEach is less performant than a for-loop

grizzled raven
#

so a for loop is better?

slender thistle
#

In terms of performance I would guess so

grizzled raven
#

yikes

#

i think i've been using map too much, only because its easy to use

#

map doesnt have a noticeable effect on ram, rifht?

earnest phoenix
#

a native for loop is a winner in performance in all of them

#

i'm going from my knowledge of other languages, but i'm guessing it's because functions like map(), forEach() etc need to create a callback for each iteration and then call that callback in memory - while a native for loop is set in code as an instruction and does not need to generate anything extra, it just goes to the pointer and does what it's supposed to do

quartz kindle
#

how the hell did forEach beat Find a few times?

finite bough
#

just like how Italy defeated china in active cases

quartz kindle
#

also, the for loop code for the find test is wrong

#

unless the actual finding part is being ignored on purpose for this test, that would also explain why the forEach may have been faster a couple times

earnest phoenix
#

they might be inaccurate, especially because of this part These result does not consider the JIT, inline caching, hidden classes, deoptimizations, garbage collection, pretenuring etc.

quartz kindle
#

yeah but even ignoring all those, the differences between forEach and find should be abysmal, if "finding" is actually being done

#

ie: breaking the loop when the item is found

#

which find does, for could do (but they didnt do it) but forEach does not

earnest phoenix
#

interesting

#

guess that makes the results invalid

quartz kindle
#

yeah, it seems to me they are measuring just the loop performance, not the performance of actually finding an item

#

oh wait

#

they are

#

then the result is indeed invalid

#

i mean

#

the code searches for a random item in an array; so depending on the random item, the difference between .find and .forEach should be drastically different on each run

copper cradle
#

map is gay and a ram eater

summer torrent
#

which is best for looping?

quartz kindle
#

for is the fastest in 99% of cases, and it pretty much can do anything the others do

#

all others are just convenience functions, which introduces overhead

#

but it mostly doesnt matter unless your code is dealing with multi-million-sized arrays lol

wide wharf
#

How can I do that the bot doesn't send messages to console which was send via DM?

    console.log('โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: ' + message.author.username + ' \nMessage: ' + message.content)});```
#

^^ It's to check that nobody is misusing my friends bot dblWink

summer torrent
#

remove console.log

#

ah wait

#

I misunderstood

sudden geyser
#

if (message.guild) {...}

summer torrent
#
if (!message.guild) return;```
uneven lichen
#

Does anybody know about bot music commands well? If so, would anyone help me? Ping me pls

sudden geyser
#

Just ask your question

copper cradle
wide wharf
#

if (message.guild) {...}
@sudden geyser Which one, this?

if (!message.guild) return;```

@summer torrent Or this?

#

@modern sable Can you help me please?

How can I do that the bot doesn't send messages to console which was send via DM?

    console.log('โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: ' + message.author.username + ' \nMessage: ' + message.content)});```
sudden geyser
#

They both work. They're just done differently.

wide wharf
#

Okay

#

And where do I place the "if (!message.guild) return;"?

sudden geyser
#

in your event message listener.

wide wharf
#

after the )});
or
in the )});

#

@sudden geyser sorry for ping ๐Ÿ˜

copper cradle
#

in your event message listener.

#

don't ping people

wide wharf
#

So in the )});

copper cradle
#

yes

wide wharf
#

Thanks

#

Im new sorry

copper cradle
#

at the very top

wide wharf
#

okay

sudden geyser
#

Learn JS pls. It needs to be before where you're logging the info to console.

wide wharf
#

Thanks!!

copper cradle
#

Yes please learn the language before attempting on doing stuff

wide wharf
#

๐Ÿ˜• but

#

I am learning

uneven lichen
#

Okay, I created a command in java script (it plays music when you type in /play (title) the song list from Youtube will be displayed) I would like to be able to cancel the song list if I make a mistake and type the name of the song wrongly. I can upload the current script I'm using and invite you to the server where my bot is located. Is there anyone who can help me? I'm a beginner.

copper cradle
#

create a message collector and collect the word cancel from the author

#

and then manage the rest

#

easy

uneven lichen
#

not for me ๐Ÿ˜„

copper cradle
#

well it's not that easy

#

but that's the logic of what you want to do

#

try to do it and if you get into a deadlock just ask here

#

easy

lethal stratus
#

am i allowed to ask people to help me test something with my bot

copper cradle
#

yes

#

but it's up to people to actually agree and help you

sudden geyser
#

Kind of. What exactly do you want tested (I may be able to help)?

royal portal
#

Since I can't get the setActivity working, I've done this but I'm not sure if it looks good.

#

(the !help was meant to be on the status but it only worked for 20 minutes so I put it on the bot's username)

copper cradle
#

wdym it only stays for 20 mins

#

it shouldn't do that wtf

#

there must be something else removing the activity

#

how did u set it

#

inside the ready event

royal portal
#

yeah I did that

#

it works on my pc but not on my raspberry pi 3

copper cradle
#

hmmm

#

weird

#

show the code

royal portal
#

its because I updated both node.js and discord.js

copper cradle
#

well that shouldn't affect ya

royal portal
#

there was like

#

a lot of ppl helping

#

but ppl cant find the issue

#

bot.on('ready', function() => {
console.log('Ready to Protect.');
bot.user.setStatus('idle')
bot.user.setGame('discord.js | Prefix: !')
});

#

it just doesn't work on my rpi3

#

well it did

#

the idle turned on but setActivity stopped working

#

i could only see setActivity for like 2 secs

#

and then 20 mins, idle gone

#

so yeah

#

I'm just asking if the '!help' looks good on the bot name

#

and if there is anyway to improve it

#

here's the screenshot again

copper cradle
#

use

#

code

#

blocks

#

ffs

royal portal
#

alr hold on

copper cradle
#

```js
//code here
```

royal portal
#
bot.on('ready', function() => {
  console.log('Ready to Protect.');
  bot.user.setStatus('idle')
  bot.user.setGame('discord.js | Prefix: !')
});
copper cradle
#

d.js v12 right?

#

lemme do something real quick

royal portal
#

yes

#

its literally

#

a bot

#

with messages

#

like if msg this

#

then msg.reply

regal saddle
#

isnt it bot.once?

royal portal
#

wdym

regal saddle
#

gimme sec

copper cradle
#

no wtf

#

try with

#

client.user.setActivity()

#

ik it's most likely to not fix anythin

#

but setActivity can do what those 2 lines of code do while looking cleaner

regal saddle
#

Thats js or not?

copper cradle
#

brb gotta change the creation date of my homework mmLol

#

yes

#

it's js

regal saddle
#

client.once('ready', () => {
client.user.setActivity('whatever you want',{type: "STREAMING", url: ""})});

#

you can use something like that too

copper cradle
#

it's the same

#

well not the same

royal portal
#

yeah i did

copper cradle
#

but you get my point

royal portal
#

but still does same thing

regal saddle
#

but you get my point
yeah

royal portal
#

like it stops after 20 mins

grizzled raven
#

wait

#

how we at 300k cases

copper cradle
#

awaiting, sir

grizzled raven
#

we were at like 100k a few days ago

copper cradle
#

then create an interval and set the status every 20 minutes

grizzled raven
#

wait

#

wrong channel

royal portal
#

well I don't know how

#

:/

regal saddle
#

how tf you dont know?

royal portal
#

but i don't want the status to change

copper cradle
#

setInterval(function that gets called every n seconds, n)

regal saddle
#

but i don't want the status to change
MegaThonk

copper cradle
#

it won't change

royal portal
#
const activities_list = [
    "test"
    ];

bot.on('ready', () => {
    setInterval(() => {
        const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
        bot.user.setActivity(activities_list[index]);
    }, 10000);
});
#

every 10 seconds btw

sudden geyser
#

10 seconds is too short

#

for dbl's requirements and Discord's API.

grizzled raven
#

4 is the minimum

copper cradle
#

wdym

#

what language and what library

#

remember

#

there's thousands of languages out there

#

well not thousands

#

but a shitload

#

of 'em

sick cloud
#

@quaint grotto read the docs

#

it hasn't changed

#

.login

heavy marsh
#

How can we get the shard id of the current guild?

#

in discord.js v12.0.2

quaint grotto
#

ok

sick cloud
#

@heavy marsh guild obj should have a shard.id property or theres other methods

heavy marsh
#

hmm ok

#

but what is .mode

broken ruin
#

What does this mean

Error: Request to use token, but token was unavailable to the client.

EDIT : +

socket hang up
#

When try to fetchUser

#

Using Discord.js

heavy marsh
#

OOh

#

message.guild.shardID

broken ruin
#

@heavy marsh do you know about discord.js?

heavy marsh
#

yep

broken ruin
#

Could you check 4S_3Up

copper cradle
#

the socket hung up

earnest phoenix
#

are you on an old version of d.js?

broken ruin
#

11 v

#

Yub

#

So client.fetchUser in 11.4.0v ignored?

open flicker
#

512 RAM is enough for mongodb ?? or will it be few?
Sorry for my English

quartz kindle
#

@broken ruin are you trying to fetch a user from a disconnected client?

#

ie: do you have new Client() more than once in your code?

broken ruin
#

No

heavy marsh
#

Is there a way to get the latency of the current guilds shard in v12.0.2

broken ruin
#

It seems in command Handler doesn't work

#

But i already export

#

Client

heavy marsh
#
bot.ws.shards.cache.get(message.channel.id).shardID
#

is this completly wrong

quartz kindle
#

show your command handler

#

or your command file

broken ruin
#

This in command name .js

async execute(message, client) {
quartz kindle
#

@heavy marsh there is no cache in shards, and there are no channels in shards

broken ruin
#

This index.js

command.execute(client, message);
heavy marsh
#
py!eval message.channel.send(bot.ws.shards.get(message.guild.id).shardID)```
#

Also wrong?

quartz kindle
#

yes

heavy marsh
#

bot.ws.shards = A collection of all shards this manager handles

broken ruin
#

Sorry for ping but could you check up @quartz kindle

quartz kindle
#

@heavy marsh yes, and indexed by shard id

#

so, shards.get(shardID)

#

not guild id

heavy marsh
#

ooh

quartz kindle
#

@broken ruin why are they reversed?

broken ruin
#

What ?

quartz kindle
#

message,client
client,message

broken ruin
#

Oh

heavy marsh
#
py!eval message.channel.send(bot.ws.shards.get(message.guild.shardID))
quartz kindle
#

ye

heavy marsh
#

but I get it as error

quartz kindle
#

what error?

heavy marsh
#

DiscordAPIError: Cannot send an empty message

quartz kindle
#

the shard is a class, either it cannot be stringified,or its being stringified to something that discord cant use as a message

#

you still need to get the property you want from the shard

heavy marsh
#

bot.ws.shards.get(message.guild.shardID) = the latency?

quartz kindle
#

ping is the latency

heavy marsh
#

bot.ws.shards.get(message.guild.shardID).ping

quartz kindle
#

yes

heavy marsh
#

ooh i see now

#

thanks

ember atlas
#

is there a way to go back to v11 of djs

heavy marsh
#

Just add the version to you package.json and npm i