#development

1 messages · Page 555 of 1

slim heart
#

Then learn how to

fringe rover
#

Node dosent work

slim heart
#

Have you actually programmed any kind of bot file

fringe rover
#

Nope

#

When i do node .

#

Don’t work

slim heart
#

Well no one here’s is gonna program a bot for you

#

Follow this series it’ll take you through the steps of learning how to program a bot

#

However you should learn how to use JavaScript before anything so try a js learning coarse

earnest phoenix
#

i figured it out nvm

#

on the emojis

slim heart
#

Alright, coolio

smoky spire
#

@fringe rover don't use the source code for the love of god, use a decent guide

slim heart
#

Keenser he can use whatever he wants don’t complain

earnest phoenix
#

thats where you are wrong kiddo

fringe rover
#

Not got a clue lolwhat

earnest phoenix
#

using youtube tutorials over docs with your knowledge of the language is very discouraged

a) you are diving facefirst into a language and a library you have never seen before
b) you are not learning anything but how to press ctrl c and ctrl v
c) your freedom is restricted and dependent on youtube tutorials, you wont be able to create anything properly yourself
d) you are using someone elses coding style and practices instead of creating your own environment you are comfortable with

fringe rover
#

But i don’t know

lofty hamlet
#

Hi

#

I have a question

#

In json i can blabla.push('Test')

#

But i can blabla.replace('Test', 'Test2')

#

How do I go ?

quartz kindle
#

push is for array not json (object)

#

for objects you can blabla.new = "test" and replace with blabla.new = "test2"

#

to replace a value in an array, you can blabla[blabla.indexOf("test")] = "test2"

earnest phoenix
#

is it possible to create global variables to be included in all command files

#

like in lua (if anybody is familiar) You can create a variable as a global and being able to access it everywhere

lofty hamlet
#

blabla[blabla.indexOf("test")] = "test2" @quartz kindle 🤔

quartz kindle
#

you have to send it to each file you want to use it in

#

assuming you're talking about node.js

#

@lofty hamlet js let bla = ["test1","test2","test3"] // create blabla array with 3 values bla.indexOf("test2") // get index position of "test2", which is index 1 bla[1] = "test5" // replace value in index 1 with new value

lofty hamlet
#

🤔

#

I go test$

quartz kindle
#

@uneven laurel it should, but there are better/easier ways to do that

lofty hamlet
#

Thanks

quartz kindle
#

use the guild's id

#

DBL's id is 264445053596991498

#

so just do if(message.guild.id === "264445053596991498") { return }

lyric talon
#

Guys, in python, how can i check if my bot has permission ?

waxen quest
#

Could anyone lead me to a solution to make my Canvas support emojis? (nodejs)

quartz kindle
#

use a font that includes emojis and register it on canvas

#

are you using node-canvas v2 or v1.6

topaz fjord
#

Font awesome is a good one

earnest phoenix
#
  if(!xp[message.author.id]){

My console is showing that and say Cannot read property "author" of undefined!

mossy vine
#

most likely because that code is out of the message scope

earnest phoenix
#

wdym

mossy vine
#

send full code

earnest phoenix
#

I can invite u to the project can u show me from there?

mossy vine
#

no

earnest phoenix
#

this is the full code

#
let xpAdd = Math.floor(Math.random() * 7) + 8;
  console.log(xpAdd);

  if(!xp[message.author.id]){
    xp[message.author.id] = {
      xp: 0,
      level: 1
    }
  }


  let curxp = xp[message.author.id].xp;
  let curlvl = xp[message.author.id].level;
  let nxtLvl = xp[message.author.id].level * 300;
  xp[message.author.id].xp =  curxp + xpAdd;
  if(nxtLvl <= xp[message.author.id].xp){
    xp[message.author.id].level = curlvl + 1;
    let lvlup = new RichEmbed()
    .setTitle("Level Up!")
    .setColor(`#36393e`)
    .addField("New Level", curlvl + 1);

    message.channel.send(lvlup).then(msg => {msg.delete(5000)});
  }
  fs.writeFile("./xp.json", JSON.stringify(xp), (err) => {
    if(err) console.log(err)
  });
#

@mossy vine ^^^

mossy vine
#

where are you running that tho

earnest phoenix
mossy vine
#

i mean

earnest phoenix
#

in my main file

mossy vine
#

no thats not what i mean either

amber fractal
#

What event

mossy vine
#

are you running it in client.on('message'...

earnest phoenix
#

uh should I be?

mossy vine
#

yes, otherwise message is out of the scope

#

please learn js

earnest phoenix
#

i know a little bit

#

i code html, batch, css, ruby, python, and php im learning js

sleek oar
#

x-www-form-urlencoded

amber fractal
#

?

mossy vine
#

@sleek oar yes

keen drift
#

yes

lyric talon
#

Guys, a dumb question:
How can i get my bot top role ?

#

I'm using cogs

#

And how can i check if a bot has permissions to do something ? in a error handler ?

slim heart
#

@lyric talon do guild.me.hasPermission(perm) because guild.me is the member object of the client

lyric talon
#

So if i want the ban_members permission it's
guild.me.hasPermission(ban_members) ?

#

in the top of a command ?

slim heart
#

Also to get the bot the “top” role the owner or someone with permission to has to do it the bot itself can’t give itself the highest role

spring ember
#

@lyric talon top role is usually the last elements in member.roles

#

On every lib

slim heart
#

Yea so basically you can also do it so if they don’t reply to the message saying the bot doesn’t have perms and then return

keen drift
#

you should just iterate and check the hoist position

spring ember
#

JDA - java member.getRoles().get(member.getRoles().size()-1)

slim heart
#

Yea dond what fishy said. It’s better to be safe then sorry

keen drift
#

some libs have it pre-computed

#

but that's the idea

#

you also need to taken account of other permission overwrites

slim heart
#

Tho any kind of connection problem could desort them I’ve seen it before but🤷‍♂️

keen drift
#

calculate permission from bit

spring ember
#

@keen drift he said top role first

#

I didn't read the rest xd

keen drift
#

he also asked And how can i check if a bot has permissions to do something ? in a error handler ?

#

so ThinkShrug

spring ember
#

.hasPermission

keen drift
#

right, djs

#

wew

spring ember
#

Also in JDA

lyric talon
#

But fishy, i can just check my bot top role, right ?

keen drift
#

not really

lyric talon
#

😮

#

Because i'm really confused with the permission overwrites and the things that u sad

#

I would just check my bot role (i don't know how to do this) and see if it's bellow the member that i will ban , role

spring ember
#

@lyric talon what library?

lyric talon
#

python rewrite

#

discordpy rewrite*

spring ember
#

yeah I got it

#

wait a sec

lyric talon
#

OK ok i'll

#

I'll send the code

#

I think that my error handler is wrong too (the bot missing permissions

spring ember
#

member.guild_permissions.ban_members

#

this should return a boolean

lyric talon
#

but member is the people who will be banned

spring ember
#

and?

#

oh wait

#

lmao

#

sorry what do you want to check?

#

if you have permissions?

lyric talon
#

Yes!

#

Example: I'll ban you

#

I want to check if i have permissions

#

Or if have something that i could take an isinstance(error, IHavePermissions)

spring ember
#

then selfmember.guild_permissions.ban_members and selfmember.top_role > othermember.top_role

lyric talon
#

How can i get the selfmember ? and another question, how can i check if the bot have a permission ?
<sorry for border you with dumb question>

#

ctx.author, ok

spring ember
lyric talon
#

And about the bot permission ?

#

Hmmm

spring ember
#

is the selfmember

lyric talon
#

got it

#

I'll try them i'll bring good news (i hope so)

#

Ty, dond

spring ember
#

as I said

#

the bot is a member as well

#

so just do member.guild_permissions (or for channel specific permissions: member.permissions_in(channel)) and check for the required permission

#

good luck

lyric talon
#

Wait, so if guild.me is a bot as a member class, if i do guild.me.top_role will return me the bot top role ?

spring ember
#

it will return the bot's highest role in the hierarchy yes

#

and > is overridden to compare hierarchy height

lyric talon
#

But it idn't '-'

#

it didn't *

spring ember
#

what do you mean

lyric talon
#

That when i tryied to use the await ctx.send the guild.me.top_role it throw me nothing

spring ember
#

maybe it doesn't have a role?

lyric talon
#

it have the bot role

#

Wait

#

As Bdantas ?

spring ember
#

no

#

it is the bot as a member

lyric talon
#

await ctx.send('{} - {}'.format(member.top_role, guild.me.top_role))
That should print the member that i'll ban Top role and the bot role

#

But it's not printing it '-'

spring ember
#

are member and guild defined?

lyric talon
#

guild is not defined in the function, i'm doing this at a cog

#

member is

spring ember
#

just do member.guild for the guild

lyric talon
#

member = discord.Member

#

in my case

spring ember
#

yes

lyric talon
#

JSUS

#

Finally

#

Ty, dond

spring ember
#

ok sure lol

earnest phoenix
#

json.push is not a function thonkku thonkku thonkku thonkku thonkku thonkku thonkku

quartz kindle
#

push is for arrays, not objects

earnest phoenix
#

oh fuck

#

i messed up code so bad

slim heart
inner jewel
#

body

slim heart
#

@inner jewel just tried that, doesnt work

inner jewel
#

log the response

slim heart
#

it gives error 400 when i use xhr if that helps

inner jewel
#

set content type header

slim heart
#

still

inner jewel
#

you can only get a 400 if your body is malformed

slim heart
#

i used multipart/form-data

#

right?

inner jewel
#

or you don't set the content type header

#

no

#

that's an invalid multipart body

#

you need application/json

#

if you want to send json

slim heart
#

still the same thing :/

#
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]:
   { body:
      PassThrough {
        _readableState: [Object],
        readable: true,
        domain: [Object],
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: true,
        _transformState: [Object] },
     disturbed: false,
     error: null },
  [Symbol(Response internals)]:
   { url: 'https://discordapp.com/api/webhooks/id/token',
     status: 400,
     statusText: 'BAD REQUEST',
     headers: Headers { [Symbol(map)]: [Object] } } }```
nova atlas
#

Does anyone use googles cloud to host your bot?

limber swan
#

someone uses bloxy for roblox bots?

quartz kindle
#

@nova atlas i do

nova atlas
#

how? lol

#

i want to run mines with it but im lost, never used a vps

quartz kindle
#

what have you tried?

nova atlas
#

yes, ive set up a windows server and ran the RDP

quartz kindle
#

what language is your bot in?

nova atlas
#

python

quartz kindle
#

i'd advise you to run linux on it

nova atlas
#

i wouldn't know how

#

to host the bot using linux

quartz kindle
#

when you set up a compute engine instance, in your google cloud dashboard

#

you can choose an operating system

nova atlas
#

i dont know what to do when im in the SSH

quartz kindle
#

worry about that after you set it up

nova atlas
#

its not set up?

quartz kindle
#

did you set up linux already?

nova atlas
#

what do you mean set it up? i selected it when i create a new instance

earnest phoenix
#

this is eris-lavalink

function getPlayer(channel) {
    if (!channel || !channel.guild) {
        return Promise.reject('Not a guild channel.');
    }

    let player = client.voiceConnections.get(channel.guild.id);
    if (player) {
        return Promise.resolve(player);
    }

    let options = {};
    if (channel.guild.region) {
        options.region = channel.guild.region;
    }

    return client.voiceChannel.join(channel.guild.id, channel.id, options);
}


getPlayer(channel).then(player => {
    player.play(track);

    player.on('disconnect', (err) => {
        if (err) {
            console.log(err)
        }
        player.leave();
    });

    player.on('error', err => {
        return message.channel.createMessage("An issue as occured. Please Try again later.")
    });

    player.on('stuck', msg => {
        return message.channel.createMessage("An issue as occured. Please Try again later.")
    })

    player.once('end', data => {

        if (data.reason && data.reason === 'REPLACED') {
            return;
        }
        player.play(track).shift();
    })
});

but it says channel is not defined why is that?

blazing star
quartz kindle
nova atlas
quartz kindle
#

i use ubuntu, but debian should be similar

blazing star
#

@earnest phoenix message isn’t defined in the function scope

earnest phoenix
#

hm

nova atlas
#

ive created another instace similar to yours

quartz kindle
nova atlas
#

correct

earnest phoenix
#

@blazing star wdym by defining message

quartz kindle
#

if you open ssh in a browser window, you will be accessing it directly already, and you can start using it

blazing star
#

message would be undefined

quartz kindle
#

learn a bit about using linux terminal to install packages

blazing star
#

unless the function is in the function where you defined message

quartz kindle
#

for example, you will need to create a folder for your bot, you can run mkdir foldername

#

you can use ls to get a list of files in the current folder

#

you can use cd foldername to change folders

blazing star
#

winscp is an option

quartz kindle
#

and use apt-get install packagename to install linux packages

sick cloud
#

also pip install npm install ammLol1

blazing star
#

it doesn’t work like that

#

or does it thonk

quartz kindle
#

as you can see, there are neverending tutorials and ways to do stuff on linux using the terminal alone

blazing star
#

digital ocean tutorials are the best

nova atlas
#

i see

quartz kindle
#

in order to move files from your pc to your vps and vice versa, you will need to use a winscp or sftp client

#

although google's ssh window does offer you an option to download files

blazing star
#

filezilla

nova atlas
#

i have a whole folder with my bots code, would i be able to import that?

topaz fjord
#

Anyone here use dunst?

quartz kindle
#

to upload a folder its better if you zip it

#

and then unzip it on the server

#

once you get the hang of navigating through files and do basic stuff to them via command line, everything becomes easy

nova atlas
#

ok thanks for the help

quartz kindle
#

in order to use 3rd party clients such as filezilla or putty, you will need to setup an ssh key, which is a bit more complicated

earnest phoenix
#

how do i get when user emoji reacts on message ID

sick cloud
#

events

earnest phoenix
#

fould it

#

it gets user, but i cant figure out how to get only user tags

#

like user#1234

#

instead of details

amber fractal
#

You on discord.js?

earnest phoenix
#

yes

amber fractal
#

messageReaction add passes a user object

#
#

You know how to set up events right?

earnest phoenix
#

no ;d

amber fractal
#

Well Ill tell you, you already have some

#

(I hope)

#

You should have stuff in your code that says client.on(...){} right?

#

Or similar

sick cloud
#

ew one file bots

amber fractal
#

We dont know if its one file

#

Can you set up events in other files?

#

All my events are in my main file atleast

#

the commands are seperate

earnest phoenix
#

yes

amber fractal
#

well that client.on stuff is an event

earnest phoenix
#

i have event for react

amber fractal
#

good.

#

You pass the reastion and user right?

earnest phoenix
#

its a copypaste but i know what it does

#

should i just ${user}

#

i see its not used

sick cloud
#

user is the person that reacted

earnest phoenix
#

ok it was so simple xd

#

i just had to figure it out

toxic minnow
#

Hey i am having a problem with installing the first dependencies for starting a discord bot, could I dm someone with my error code

loud salmon
#

just post the error code here

toxic minnow
amber fractal
#

It tells you exactly what it is tho

keen drift
#

read the error message NotLikeThis

amber fractal
toxic minnow
#

sorry im kinda new at this, ive been learning java in school and just started playing around with this

bleak leaf
#

doesn't read error, complains to people wesmart

#

We all start somewhere

toxic minnow
#

should it be ' instead of "?

keen drift
#

should prob like, show the content of that file

sick cloud
#

use discord.js

toxic minnow
sick cloud
#

lmao notepad

keen drift
#

what kind of quote is that

toxic minnow
#

oh that makes sense

sick cloud
#

we got a meme here

#

oh your using that dumb outdated tutorial

amber fractal
#

It isnt just a font?

keen drift
#

idk, looks like some weird quote

#

on like weird keyboard

bleak leaf
#

" natural

sick cloud
#

its called notepad

amber fractal
#

Well in typography, an open quote goes up a closing quote goes down.

#

Curly quotes and straight quotes arent the same

earnest phoenix
#

im having a problem here

#

let cancer = args.join(" ")

#

it will get only first argument

#

but after space is hit it will ignore

#

how can i include space and text after

obsidian ember
#

args.slice(0).join(" ")

#

@earnest phoenix

#

using node.js, how can I use the .getVotes() to fetch the last 1000 votes, and sort them all into a message?

amber fractal
#

.getVotes returns a object promise right?

#

iterate through the object and log the keys

#

not log,

#

but like put them into an array or something

#

however you want to handle it

obsidian ember
#

Said I can't put them into a array

and when I tried for(const data of) it didnt work either
(node:7046) UnhandledPromiseRejectionWarning: TypeError: votes is not iterable

keen drift
#

show code

amber fractal
#

of is a collection iterator

#

use in

obsidian ember
#

let votes = dbl.getVotes().toArray() is what I tried to put it into a array

amber fractal
#

well that wouldnt work because .getVotes() returns a promise

#

I think

keen drift
#

yeah

amber fractal
#

gotta do a .then

keen drift
#

and it's an object

obsidian ember
#

sorry not sure what to do

amber fractal
obsidian ember
#

yeah, looked at the api again and found that

amber fractal
obsidian ember
#

got a bunch of objects

#

so I think I got it

#

no arguments for me to use on the website tho

keen drift
#

?

obsidian ember
#

Nevermind I figured it out

#

.getVotes() doesnt have that so I didnt know what to use

amber fractal
#

votes is an object

#

it has users as 1s or 0s

#

in the last 24h

#

iirc

sturdy delta
#

Hey. Does anyone know how to do something on guild join?

earnest phoenix
#

i want bot to ignore ids

#

but when i put ids in blacklist.json

#

it doesnt work

#

users is like "users": ["id", "id2"]

amber fractal
#

if you parse blacklist anyways*

earnest phoenix
#

works

#

retarded people, abusing commands that they dont have access to lol

#

now i just need to find a way to write ID directly to blacklist.json

amber fractal
#

My bot auto blackists spam

earnest phoenix
#

teach me master xd

amber fractal
#

It's kinda simple tbh

#

There's a global cd of 5 seconds on using a cmd. if you spam it while its on cd after it told you, you get blacklisted

#

I would lower it

earnest phoenix
#

you use json?

#

to store ids

amber fractal
#

but no one compained yet

#

I dont use json for a lot of things, but that is one of them yea

#

All my important data is in dbs

earnest phoenix
#

i just wanna blacklist people 😠

amber fractal
ruby talon
sturdy delta
#

@ruby talon i am using JAvaScript

ruby talon
#

Oki.

#

You didn't provide that info so I wouldn't be able to know that.
@amber fractal answered your question then.

dull idol
#

What's the best permissions for Warn command

#

Kick members?

sick cloud
#

depends on what you want

#

personal opinion i prefer manage messages or server, but you can also allow the server to give indiv. users access or a specific set of roles

desert bough
#

anyone got any idea how I could make a reaction on an embed message make my bot kick the user mentioned?

sturdy delta
#

if there were corrupt files in my system, affecting my VSC, where would they be?

#

@ruby talon

ruby talon
#

Most likely in the place where your VSC extensions get saved.

tulip grove
#

Can I ask questions about the Discord API here?

#

Or get help here?

ruby talon
#

Yes.

tulip grove
#

Okay so

#

If you want to send a message

#

To a channel

#

You do this

ruby talon
#

You have to provide enough info tho.
Language ect.

tulip grove
#

No not

#

Um

#

If you want to send a Message to a channel through the API, you use this
POST channels/{channel.id}/messages

#

And the JSON parameters

#

Right?

desert bough
#

put a $ in front of the {}

tulip grove
#

It's not js

desert bough
#

that would've been nice to know

tulip grove
#

Yeah

#

It's not language specific

#

I guess

#

Http API or something like that

#

But my question is

#

What if you want to send a DM

#

Trying to build something through my webhook without directly Interacting with the API library

desert bough
#

im not actually sure lemme check something

tulip grove
#

Okay

desert bough
tulip grove
#

Lemme try that

desert bough
#

hmm

#

just checked

#

its not aparently

tulip grove
#

Yeah..

desert bough
#

how are u triggering the dm

tulip grove
#

That's what I'm trying to figure

desert bough
#

i mean if u wanna test where the ID comes from do it in ur dms with ur bot with like prefix test then ocmpare it to the browser

tulip grove
#

Okay

#

Thanks

desert bough
#

sorry i cant be of more assistance

tulip grove
#

It's cool

earnest phoenix
#

😦 help

magic urchin
#

my bot was declined 'cause I didn't have anything original about my bot H-Bot Deluxe, but it has custom cogs n stuff

desert bough
#

cogs?

magic urchin
#

yee

desert bough
#

wdym

magic urchin
#

cause its a heavily alted version of Red

desert bough
#

whats red

magic urchin
#

like a base bot

#

with basic functions

#

but adding cogs allows it to be different

void mantle
#

this is the channel for this discussion uwuwu

desert bough
#

anyone know how I can correct this MySQL error Error: ER_BAD_FIELD_ERROR: Unknown column 'eu' in 'field list'

amber fractal
#

Theres an unknown column labeled "eu" in "field list"

desert bough
#

not from what i can see

earnest phoenix
#

show the query

desert bough
#

ive fixed it now

sick cloud
#

use codeblocks for first

quartz kindle
#

how to fix DeprecationWarning: Collection#filterArray: use Collection#filter instead:
use .filter() instead of .filterArray()

how to fix UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions:
check for permissions before doing whatever you're doing

how to fix UnhandledPromiseRejectionWarning: Unhandled promise rejection:
catch promises by using .catch() or by using try/catch if you use async/await

how to fix [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated:
same as above

how to fix TypeError: Cannot read property 'channels' of null:
your message does not contain a guild, perhaps its a DM?
@uneven laurel

warm marsh
#

Read the error...

#

thisArray.filter() is what it's telling you to use not thisArray.filterArray()

#

@quartz kindle

quartz kindle
#

?

sick cloud
#

@warm marsh thats what he said lmao

warm marsh
#

What?

#

The error clearly says use filter over filterArray

#

and to check permissions

rocky dagger
#

Why am I getting an error on this? css fs.writeFile("./warnings.json", JSON,stringify(warns) (err) => { if (err) console.log(err) });

mossy vine
#

JSON,stringify

#

wonder why

rocky dagger
#

Is that a joke or what?

amber fractal
#

No

#

Its the error

slim heart
#

@rocky dagger do ya see it yet

sick cloud
#

,

#

eyes literally

slim heart
#

Lol

earnest phoenix
#

Yo guys

#

I have herko premiums and I want to know the spec CPU

sick cloud
#

ask heroku

amber fractal
#

If you get pay for heroku, might as well just get a vps

dusky marsh
#

I only use heroku because of the money you get from their student pack

earnest phoenix
#

In js is it ${bot.users.size} to check the amount of people not guilds?

slim heart
#

@earnest phoenix correcto

sick cloud
#
Traceback (most recent call last):
  File "bot.py", line 1, in <module>
    import discord
  File "C:\Users\ThatTonybo\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 38, in <module>
    from .state import ConnectionState
  File "C:\Users\ThatTonybo\AppData\Roaming\Python\Python37\site-packages\discord\state.py", line 36, in <module>
    from . import utils, compat
  File "C:\Users\ThatTonybo\AppData\Roaming\Python\Python37\site-packages\discord\compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

think whats up here

smoky mica
#

so apparently this ```js
aliases: [${prefix}bl]

#

i removed the ${prefix} part and it worked but i want that in there

sick vine
#

Discord.js thanos snapped my bot

lyric talon
#

Hey guys :)
Could someone help me ?
I have a command named afk that when someone set this, the bot will send a message to everybody who pings this person.
But when i try to ping this person (considering that he is in the afklist ), the bot doesn't send the message.
Here is my code https://pastebin.com/mZpaT2ZX
It's on pastebin because the hastebin is off for me :/
I don't think that's the best way to define my command, but it was the easier way that i could think.

amber fractal
#

Instead of using if '@' in message.content: and i use js, so i may be wrong. But does the lib your using have a .mentions property for message objects? what lib is that?

echo badger
#

events.js:183

  throw er; // Unhandled 'error' event

  ^

Error: listen EADDRINUSE :::3000

at Server.setupListenHandle [as _listen2] (net.js:1360:14)

at listenInCluster (net.js:1401:12)

at Server.listen (net.js:1485:7)

at Function.listen (/rbd/pnpm-volume/4fc25bdb-071c-4bec-9141-4477c5ce57c3/node_modules/.registry.npmjs.org/express/4.16.4/node_modules/express/lib/application.js:618:24)

at Object.<anonymous> (/app/bot.js:45:5)

at Module._compile (module.js:653:30)

at Object.Module._extensions..js (module.js:664:10)

at Module.load (module.js:566:32)

at tryModuleLoad (module.js:506:12)

at Function.Module._load (module.js:498:3)

(node:3704) UnhandledPromiseRejectionWarning: Error: Shard 1's process exited before its Client became ready.

at Shard.once (/rbd/pnpm-volume/4fc25bdb-071c-4bec-9141-4477c5ce57c3/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/sharding/Shard.js:88:39)

at Object.onceWrapper (events.js:315:30)

at emitOne (events.js:116:13)

at Shard.emit (events.js:211:7)

at Shard._handleExit (/rbd/pnpm-volume/4fc25bdb-071c-4bec-9141-4477c5ce57c3/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/sharding/Shard.js:272:10)

at emitTwo (events.js:126:13)

at ChildProcess.emit (events.js:214:7)

at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

(node:3704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 40)

#

Help

last ferry
#

maybe if you read your error

#

      throw er; // Unhandled 'error' event

      ^
#

this is where it erroered

#

so you arent throwing your errors right

echo badger
#

kk

#

I will debug

#

thx

smoky mica
#

how do i list the no. of text channels
and total categories

#

add aliases: ["alias"]

#

@earnest phoenix

#

uhm all your js files

#
module.exports.help = {
    name: "",
    description: "",
    usage: ``,
    aliases: [""]
}```
#

add that to all your js files

#

no

#

JS files

#

files ending with .js

#

not that one as i said

#

thats main file

#

my bad

#

if you have a have a file called example serverinfo type in name: "filename", and etc for all command files

#

read again^

#

oh um did you add alias

#

lol i used to get that error but i forgot how i fixed it 🤦

#

and i feel pretty brain dead atm

#

nooo

#

you don't add it in index

#

whats the file that starts your bot?

#

you got this code from menu docs i guess?

#

mate anyways you put this code in the file that starts your bot.

#

and remove module.exports.help from there

#

ok listen

#

simple question

#

what file starts your bot?

#

The code you sent me is from which file?

#

you don't add that there

#

are you tryna make a command handler?

#

then why all that code?

#

lol

#

okay

#

it was pretty ez you just added random stuff

#

that was the command handler code btw\ lmao

lyric talon
#

Sorry guys i had a problem

desert bough
amber fractal
#

Because await is only valid in an async function

desert bough
#

yeh but im not sure how I can correct that

lofty hamlet
#

@quartz kindle ?

amber fractal
#

Make the function an async function

lofty hamlet
#
            fonction.channellogs(message)
            let xoargs = message.content.split(" ").slice(1).join();
            let xoargs1 = message.content.split(" ").slice(2).join();
            if (!xoargs) return message.reply("Erreur :Croix: : `Entrez le nom du pokémon à remplacé`")
            if (!xoargs1) return message.reply("Erreur :Croix: : `Par quel pokémon voulez-vous le remplacer ?`")
            //console.log(Dresseur.Sac.includes(xo03))
            if (Dresseur.Sac.includes(xoargs) || (Dresseur.LSSac.includes(xoargs) || (Dresseur.SSac.includes(xoargs)))) {
                Dresseur.Sac.indexOf(xoargs)
                Dresseur.Sac[1] = xoargs1
                var embedGlobal = new Discord.RichEmbed()
                    .setColor(embedcolor)
                    .setTitle("Pokémon remplacé")
                    .setThumbnail(message.author.displayAvatarURL)
                    .addField("Remplacé : ", xoargs)
                    .addField("Par : ", xoargs1)
                    .setFooter(client.user.username + " - by Nebulus")
                    .setTimestamp()
                message.channel.send(embedGlobal)
            }
            else if (!Dresseur.Sac.includes(xoargs)) {
                message.channel.send("Erreur :Croix: : `Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)`")
            }
        }```
#

My code 👁

smoky mica
#

steven, how do i filter to show the amount of bots in a server,

desert bough
#

@amber fractal how do i do that

lofty hamlet
#

But the pokemon is not find all the time the answer is : ""Erreur :Croix: : Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)""

amber fractal
#

use .fliter() and check if the bot is true

smoky mica
#
.addField("Humans", message.guild.members.filter(member => !member.user.bot).size, true)
#

How could I transform that into for bots lol

amber fractal
#

@desert bough add async before the function, you might wanna read up on it tho

#

get rid of the !

#

I think

smoky mica
#

omg

#

IT WAS THAT EASY

desert bough
#

its not in its own function tho

smoky mica
#

Thanks.

random rapids
#

Do you guys know if patreon has a thing where bots can pull how much has been donated? I saw something similar the other day and it baffled me

smoky mica
#

It worked if you still didn't understand xD

#

Not really.

lofty hamlet
#

Help me plz bloblul

#
            fonction.channellogs(message)
            let xoargs = message.content.split(" ").slice(1).join();
            let xoargs1 = message.content.split(" ").slice(2).join();
            if (!xoargs) return message.reply("Erreur :Croix: : `Entrez le nom du pokémon à remplacé`")
            if (!xoargs1) return message.reply("Erreur :Croix: : `Par quel pokémon voulez-vous le remplacer ?`")
            //console.log(Dresseur.Sac.includes(xo03))
            if (Dresseur.Sac.includes(xoargs) || (Dresseur.LSSac.includes(xoargs) || (Dresseur.SSac.includes(xoargs)))) {
                Dresseur.Sac.indexOf(xoargs)
                Dresseur.Sac[1] = xoargs1
                var embedGlobal = new Discord.RichEmbed()
                    .setColor(embedcolor)
                    .setTitle("Pokémon remplacé")
                    .setThumbnail(message.author.displayAvatarURL)
                    .addField("Remplacé : ", xoargs)
                    .addField("Par : ", xoargs1)
                    .setFooter(client.user.username + " - by Nebulus")
                    .setTimestamp()
                message.channel.send(embedGlobal)
            }
            else if (!Dresseur.Sac.includes(xoargs)) {
                message.channel.send("Erreur :Croix: : `Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)`")
            }
        }```
amber fractal
lofty hamlet
#

But the pokemon is not find all the time the answer is : ""Erreur :Croix: : Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)""

random rapids
#

Oh crap 😂 ty @amber fractal

smoky mica
#
.addField("Bots", message.guild.members.filter(bot => bot.user.bot).size, true)

That's what I made it

amber fractal
#

Yes

#

that works, right>?

smoky mica
#

Yeah

amber fractal
#

py contains a .mentions property

#

Im not sure what to do after that tho cuz I dont use py

desert bough
#

@amber fractal im not sure how I can make my bot.on("message") asynchronous

lyric talon
#

yes yes i'm using this now 😃 ty, steven

amber fractal
#

Oh, sorry for the late response

desert bough
#

im not sure how I can make my bot.on("message") asynchronous

lyric talon
#

Np 😃

amber fractal
#

bot.on('message', async message =>{})

desert bough
#

@amber fractal put that in still error

amber fractal
#

did you restart the bot

#

?

desert bough
#

yes

amber fractal
#

what is the error

desert bough
#
^^^^^
SyntaxError: await is only valid in async function```
quartz kindle
#

you need to put async in all the functions that are part of the hierarchy

#
async function({
    async function({
        await something() //ok
    })
})

async function({
    function({
        await something() //error
    })
})```
#

if you have a command handler, or modules, you need to put async in the module exports function

desert bough
quartz kindle
#

there is

#

then(msg =>)

#

thats a function

lofty hamlet
#
            let xoargs1 = message.content.split(" ").slice(2).join();```
#
Doduo,azsq
Par :
azsq
quartz kindle
#

so you need then(async msg =>)

lofty hamlet
#

?replace Doduo azsq

#

My code 👆

quartz kindle
#

i dont get it @lofty hamlet , what are you trying to do?

lofty hamlet
#

Look

desert bough
#

aparently my project cant find the mutes.json file even tho its in the same directory and I have var mutes = require('./mutes.json');

lofty hamlet
#

You want all code of my command

#

?

quartz kindle
#

i dont know what you want to do

lofty hamlet
#

I want when i use : ?replace Args1 Args2
MLy bot send the args

#
            let xoargs1 = message.content.split(" ").slice(2).join();```
#

With this

#

When i enter :

#

?replace Doduo azsq

#

TRhe bot send :

#
Doduo,azsq
Par :
azsq
#

instead of :

#
Doduo
Par :
azsq
#

@quartz kindle

quartz kindle
#

.slice(1).join() removes the first item

#

so if your array is: ["prefix","arg1","arg2","arg3"], when you use .slice(1) you will have ["arg1","arg2","arg3"], then you use .join() and you get arg1,arg2,arg3

lofty hamlet
#

🤔 so ?

quartz kindle
#

.join() always puts the items together separated by a comma, if you dont specify an argument

#

if you want to get only 1 item, not more

#

dont use join

#

just get the item directly

#
array = message.content.split(" ").slice(1); // args without prefix
array[0] // arg 1
array[1] // arg 2
array[2] // arg 3
array.join() // arg1,arg2,arg3```
lofty hamlet
#

So i can use : array = message.content.split(" ").slice(1); let xoargs = message.content.split(" ").array[1].join();

#

🤔

#

In my case, how do I do?

#

@quartz kindle

quartz kindle
#

learn js lol

#
array = message.content.split(" ").slice(1); // ["arg1","arg2"]
message.content.split(" ").array[1] // error, thats not how it works.
// array already contains the sliced message content, you dont need to get it again```
lofty hamlet
#

In my case, how do I do?

quartz kindle
#

you learn js

#

instead of asking for code

lofty hamlet
#

'-'

#

My code was almost working

quartz kindle
#

i literally told you what to do

#
array = message.content.split(" ").slice(1); // args without prefix
array[0] // arg 1
array[1] // arg 2
array[2] // arg 3```
lofty hamlet
#

🤔

#

ah bloblul

quartz kindle
#

no join

#

.>

lofty hamlet
#

fail*

#

let xoargs = array[1]

#

Ok thanks

desert bough
#

i get this error when trying to exclude the bots id from my filter for reactions const reactions = await msg.awaitReactions(reaction => reaction.emoji.name === "✅" && reaction.user.id != "447752778174038018"); TypeError: Cannot read property 'id' of undefined

#

is there an alternative

quartz kindle
#

user is not part of reaction

#

its a second argument in the function

#

(reaction,user) =>

desert bough
#

ok thanks

#

i added that in and now it says reaction is not defined

#

@quartz kindle

quartz kindle
#

show how you did it

desert bough
#

const reactions = await msg.awaitReactions(reaction, user => reaction.emoji.name === "✅" && user.id != "447752778174038018");

quartz kindle
#

(reaction,user) =>

#

((reaction, user) =>

lyric talon
#

Guys, in the discord.py rewrite, how can i get the time since a person send an specific message ?

desert bough
#

why two brackets?

amber fractal
#

They arent brackets

quartz kindle
#

you cant pass multiple arguments in the short form

desert bough
quartz kindle
#

yes

lyric talon
#

hmmm

#

So i just need to use math

#

xD

#

Ty, stephen

amber fractal
#

Its Stodd

lyric talon
#

stodd ? GWqlabsGarThink

amber fractal
#

Stodd, yes

lyric talon
#

Oh, ty stodd

#

xD

amber fractal
#

Np

quartz kindle
#

if you're stodd, why is your name stephen then? lmao

amber fractal
#

Wait

#

Wait

#

Who tf

quartz kindle
amber fractal
#

Imma find that mod mmLol

real pond
#

why would i be told i dont have permissions when redirecting the monstacord bot to a specific channel when im the admin in the discord

amber fractal
#

Bot perms?

desert bough
quartz kindle
#

does it log anything if you remove the filter or allow all?

ruby dust
#

is it a good idea to encrypt a password by using itself as a key, assuming that I do not want them to be decryptable, but lets say store the encrypted version for comparison reasons only?

earnest phoenix
#

nvm,

#

XD

quartz kindle
#

@ruby dust for passwords, hashing is always better than encryption, because hashing is unreversible

ruby dust
#

hm?

quartz kindle
#

encryption = 2-way, encryption and decryption

#

hashing = 1-way, after hashing there is no going back

ruby dust
#

huh, is there a specific hashing or can you give me a link to one

quartz kindle
#

the most secure these days is probably b-crypt

ruby dust
#

alright, thanks

quartz kindle
#

argon2
PBKDF2
bcrypt
scrypt```
scarlet solar
#

Hello this is only for peple with Windows! Sorry Linux, Mac...
Ok so i wanted to do an auto updater in batch and when i open the main file i want to start the updater too and the problem is that i want to check witch the updater (that is a batch file) if it is the update day or past than the update day.
How could i do that, i tried ```
IF %date:~7,2%==13 (GOTO :run_it) else (GOTO :no_run)

:run_it
CLS
REM run whatever command
ECHO Running the command...
DIR C:
GOTO END

:no_run
REM Notify user that it is the wrong day
ECHO Wrong day!

:END```

quartz kindle
#

you're trying to use a fixed update day ?

obsidian ember
#

hello, so I found these two errors exactly one hour a part from each other.
https://hastebin.com/umidohatug.coffeescript
Just wondering if they'd have anything to do with DBL or if I should be worried about something else

quartz kindle
#

dbl is having issues atm

obsidian ember
#

oh, and using node.js

empty axle
#

How do I make a star board in discord.js?

#

🤔

obsidian ember
#

alrighty

quartz kindle
#

a star board like the one in this server?

#

track reactions and make the bot post the message on another channel when it reaches enough reactions

empty axle
#

How?

quartz kindle
#

use the reaction add event

#

are you on discord.js?

empty axle
#

Yes

quartz kindle
empty axle
#

Thanks GWqlabsLove

#

In case "messageReaction" its the message?

#

@quartz kindle

quartz kindle
#

its the reaction

#

it contains the message in one of its properties

empty axle
#

From the message?

quartz kindle
#

yes

empty axle
#

Ok

#

Thanks again

#

:3

quartz kindle
empty axle
#

GWseremePeepoLife Help

earnest phoenix
#
    client.play = (guild, song) => {
        const serverQueue = client.queue.get(guild.id);
    
        if (!song) {
            serverQueue.voiceChannel.leave();
            client.queue.delete(guild.id);
            return;
        }
    
        const dispatcher = serverQueue.connection.playStream(ytdl(song.url, { filter: 'audioonly'}))
            .on('end', reason => {
                if(serverQueue.loop[0]) {
                    serverQueue.songs.push(serverQueue.songs[0]);
                }
                if (reason === 'Stream is not generating quickly enough.') console.log('Song ended.');
                else console.log(reason);
                serverQueue.songs.shift();
                client.play(guild, serverQueue.songs[0]);
            })
            .on('error', error => console.error(error));
            dispatcher.setVolumeLogarithmic(serverQueue.volume / 100);
    
        serverQueue.channel.send({embed: { color: 65292, title: "![discomapez](https://cdn.discordapp.com/emojis/507761345345748995.webp?size=128 "discomapez") Now Playing:", description: `**[${song.title}](${song.url})**
        ![dbiqueue](https://cdn.discordapp.com/emojis/496564389638438915.webp?size=128 "dbiqueue") \`Duration: ${serverQueue.songs[0].duration.hours} hours ${serverQueue.songs[0].duration.minutes} minutes ${serverQueue.songs[0].duration.seconds} seconds\``}}).catch(console.error);
    }

this is what i have for the play function
and im trying to make it so when the song is done and it goes to the next song, it edits the embed to that song
how would i do that?

quartz kindle
#

.send().then(msg => save message id somewhere)

#

on next song: .get(savedid).edit()

#

or just save the message object itself

#

@empty axle did you fix it? if not, post your code

ruby dust
#

does the while loop break instantly when the condition is no longer true, or does it have to finish the last loop that it started?

quartz kindle
#

it checks for the condition when it begins the loop

#

if the condition is still true then, it will finish the entire loop

#

else, it doesnt initiate the loop

ruby dust
#

I mean, I have a few sleeps in one of my loops, so will they end instantly in the middle of the sleep or do all sleeps have to go through?

quartz kindle
#

python? idk how python works, but i assume they will all go through

#

because the loop is just an initializer for the function

#

the function itself runs like any other function, and respects timers/sleeps/promises

ruby dust
#

alright thanks

earnest phoenix
#

Why is this error showing up.

#

"MaxListeners"

blazing star
#

it’s not an error, it’s a warning saying you have a possible memory leak

earnest phoenix
#

How would I fix it?

blazing star
#

read the warning

earnest phoenix
#

where would I put emitter.setMaxListeners(20)

blazing star
#

client.setMaxListeners(...)

earnest phoenix
#

so like: bot.setMaxListeners(number)?

blazing star
#

yea

earnest phoenix
#

alright and the number doesn't have to be in ""

blazing star
#

it’s a number not a string so yes

earnest phoenix
#

Ohh

#

alright

#

I litterally did what you said

#

@blazing star

blazing star
#

you should put it after you define the client

earnest phoenix
#

I did.

quartz kindle
#

dont blindly increase max event listeners

#

find out why you're adding so many listeners lol

quartz kindle
#

are you using client.on() inside a .on("message)?

earnest phoenix
#

I use bot.on

#

and Idk

quartz kindle
#

show the rest of your code

earnest phoenix
#

If you want 1.7k lines sure

quartz kindle
#

put them in a pastebin or whatever

silver lintel
#

@loud salmon can you please invite my bot back into this server? i fixed the problemn

quartz kindle
#

your code is confusing af lmfao

earnest phoenix
#

Yeah..

quartz kindle
#

but basically

blazing star
#

inb4 client.on("event", () => client.on("event"))

#

o

quartz kindle
#

looks like you're creating a guildCreate listener on every single message

blazing star
#

bad practice

quartz kindle
#

not only bad practice, its actually a memory leak

#

and a pretty bad one

blazing star
#

I wouldn’t recommend using events inside events unless it’s a one time event that can be used with .on

#

or it’s not fired every second

earnest phoenix
#

Oh I wasn't trying to.

#

I'm very new to programming

#

and still don't understand some

quartz kindle
#

basically just move all event listeners outside of each other

#

they should all be siblings

blazing star
#

or use an event handler

#

which would do that for you

#

well not really, but it will listen for events

earnest phoenix
#

yeah idk how to do that

blazing star
#

and not cause any memory leaks

quartz kindle
#

d.js basically already does that for you

blazing star
#

it sets the max listeners to infinity?

quartz kindle
#

no, it handles events

blazing star
#

oh yeah

#

I mean a custom event handler

quartz kindle
#

yeah but why

#

like

blazing star
#

like events in a folder or something

#

I do that and each module is a class instance of an event

quartz kindle
#
.on("evt1", (){})
.on("evt2",(){})

vs
.on("all",(evt){
    if(evt === "evt1") {}
    if(evt === "evt2") {}
})
#

if thats what you're refering to with "event handler"

blazing star
#

nope not what i’m referring to

earnest phoenix
#

so I moved the second bot.on on top of the first one

#

like switched the placemenent

#

I'm not getting that warning anymore

blazing star
quartz kindle
#

well, thats not how i would use the term "event handler"

#

but i see what you mean

blazing star
#

oh ok

#

then what would I refer to it as thonk

quartz kindle
#

i would just call that adding custom events lol

blazing star
#

ok

scarlet solar
#

Hello this is only for peple with Windows! Sorry Linux, Mac...
Ok so i wanted to do an auto updater in batch and when i open the main file i want to start the updater too and the problem is that i want to check witch the updater (that is a batch file) if it is the update day or past than the update day.
How could i do that, i tried


:run_it
CLS
REM run whatever command
ECHO Running the command...
DIR C:\
GOTO END

:no_run
REM Notify user that it is the wrong day
ECHO Wrong day!

:END```
quartz kindle
#

are you using system dates? like windows's date?

#

people can change their dates and fool your updater

empty axle
#

@quartz kindle No

#

I'm trying to correct

quartz kindle
#

post code

empty axle
#

Wait

#

@quartz kindle

#
bot.on('messageReactionAdd', (messageReaction, user) => {
    let embed = new RichEmbed()
    .setColor('GOLD')
    .setDescription(`New Star!\n${messageReaction} ${user}`)
    .setAuthor(bot.user.username, bot.user.avatarURL)
    bot.channels.get('535611718571655210').send(embed)
    bot.channels.get('535611718571655210').send(`⭐ | ${messageReaction.channel.name}`)
})
blazing star
#

starboards take more work than that, but I don’t see an issue

empty axle
blazing star
#

but what is the issue

blazing star
#

oof undefined

empty axle
#

Well

blazing star
#

that’s an issue with the values

#

you should check them

empty axle
#

@blazing star I followed (or tried) the documentation

sick cloud
#

what documentation

blazing star
#

probably discord.js docs

quartz kindle
#

you should probably use the actual values you want, ie: user.username

#

not the object

#

also, dont send two messages in a row, you can send a text and an embed in the same message

empty axle
#

Ok

blazing star
#

yeah you can do <Channel>.send("content", { embed })

quartz kindle
#

also, remember that will look for reactions in ALL servers

blazing star
#

that’s why guild configs play a big part in bots

empty axle
#

I know @quartz kindle ksksksk

#

@blazing star Thank you

sick cloud
#

not even checking if its\⭐ tho

blazing star
#

yeah true

silver lintel
#

so ive got this:

bot.on("messageUpdate", function(oldMessage, newMessage) {

});

that displays the old msg and new msg, but how can you find the channel that it was edited in, and the user who edited it?

blazing star
#

it can be any reaction zoomeyes

quartz kindle
#

well, its for testing, so its fine

blazing star
#

function

#

you can use the newMessage object smh

quartz kindle
#

check the proprieties of the messages

silver lintel
#

how?

empty axle
#

@blazing star
bot.channels.get('535611718571655210').send(`⭐ | ${messageReaction.channel.name}`, { embed })

quartz kindle
#

each of those messages is an object

empty axle
#

This?

blazing star
#

yeah that works

quartz kindle
#

@silver lintel you know how the message object has many proprieties, such as message.id message.content message.channel etc...

silver lintel
#

oh yeah

quartz kindle
#

newmessage and oldmessage are basically a message

silver lintel
#

thanks

#

what about the user?

blazing star
#

.author

quartz kindle
#

^

silver lintel
#

why am i so stupid today

blazing star
#

¯_(ツ)_/¯

silver lintel
#

nomally i can find that out

#

ok thx anywaZy

blazing star
#

np

empty axle
#
    bot.channels.get('535611718571655210').send(`⭐ | ${messageReaction.channel.name}`, { embed })
                                                                               ^

TypeError: Cannot read property 'name' of undefined```
lyric talon
#

Guys, in discord bot py rewrite, how can i handle a error when the person writes a command that don't have in the code ?

blazing star
#

There’s a on_command_error event

empty axle
#

@blazing star Well

blazing star
#

nice

empty axle
#

Did not work very well

blazing star
#

yea

empty axle
#

Do you want the code?

blazing star
#

nah i’m good

empty axle
#

Can you help me fix it?

bright spear
#

its pretty obvious

blazing star
#

yea

bright spear
#

you're trying to send an object in the message

blazing star
#

you put an object not a stringible propety

bright spear
#

like

empty axle
#

What GWnanamiHanekaWhat

bright spear
#

you cant send a box on discord

lyric talon
#

ty, var 😃

bright spear
#

but you can send "box" on discord

#

u tried to send a box

empty axle
bright spear
#

can u just read the docs for the lib you're using

amber fractal
#

Do you know what an object is?

lyric talon
#

But a question. i'm using an error handler for every command

blazing star
#

wait, what

lyric talon
#

wait, what was for me ? haha

blazing star
#

yes it was for u

silver lintel
#

so currently, my bot sends @silver lintel. how do you make it so it is the mention

earnest phoenix
#

should work just like that

silver lintel
#

but its in an embed

bright spear
#

you can

#

in the description or field value

#

just not titles

silver lintel
#

in the description

night imp
#

Oh I thought he meant code embed

bright spear
#

it works

#

unless its in a codeblock

silver lintel
#

oh wait

#

yeah, the title doesnt work

#

ill just do .username

royal lotus
#

Hi, I'm from the Pokécord Official Server and we've been getting reports about people getting a 503 error, What is this and could be solve it?

inner jewel
amber fractal
#

Dbl servers = discord servers atm

loud salmon
#

@royal lotus we know about the issue and are working on a solution

#

its on our end rn

#

sorry about that

royal lotus
#

Thats alright, I just wanted an answer

#

Because so many ppl come up

#

And we thought they were banned because of breaking Discord ToS

#

😂

#

Thanks for that

sturdy delta
#

Hi could someone help me with a command that automatically logs joins and leaves in a channel called welcome-goodbye .

lyric talon
#

Of course, lachie

#

larchie

#

on member join and on member remove

empty owl
#

uh

#

@sturdy delta

#

what lib

sturdy delta
#

Discord.js

#

@lyric talon I need it to find the thing, but nvm someone on alternate server helped

lyric talon
#

ohhhh, ok

#

Np 😃

empty owl
#

@sturdy delta look at the docs

#

EVENTS tab

sturdy delta
#

let sendChannel = bot.channels.get("ID")
sendChannel.send("MESSAGE")

#

Would that work?

#

To find the channel

night imp
#

You would have to get the guild then the channel

#

bot.guilds.get(id).channels.get(id).send

empty owl
#

@night imp

#

@sturdy delta

#

you only need to find the channel id

amber fractal
#

Actually dont have to get the guild...

#

Ye

empty owl
#

lol

night imp
#

damn should probably stop talking here, I am using really old d.js

sturdy delta
#

Lol

#

😂

#

So this’d be fine

amber fractal
#

Well unless you sharding

sturdy delta
#

let sendChannel = bot.channels.get("ID")
sendChannel.send("MESSAGE")

#

What’s shardinf

empty owl
#

u dont need to know until

#

u reach like 2500 servers

amber fractal
#

The act of splitting your client into multiple processess to handle a smaller amount of servers

#

Yea

empty owl
#

basically cloning

#

hey um

#

so say u have js [ { ID: 'userInfo_7', data: { username: 'User6', balance: 9999 } }, { ID: 'userInfo_1', data: { username: 'User', balance: 9000 } }, { ID: 'userInfo_4', data: { username: 'User3', balance: 4000 } }, { ID: 'userInfo_8', data: { username: 'User7', balance: 700 } },

#

and u want only the username and ballance

#

how would u do that

amber fractal
#

Is that in an array?

#

cuz you have a [

#

at the beginning

empty owl
#

yea

#

and also get only the top three

#

or 5

amber fractal
#

is that in json or

empty owl
#

no its in an array

amber fractal
#

Oh just an array

empty owl
#

like db.startsWith('userBalance', { sort: true, sortBy: '.balance' }); returns that

earnest phoenix
#

Can a bot dm a bot?

empty owl
#

yea

amber fractal
#

It'd be easier if it were just an object, I believe

empty owl
#

o

#

is there a way to filter them

amber fractal
#

Like my user data is set up something like this { id: {balance: bal, items: {item_name: name}}

#

I forgot a `}~

empty owl
#

to only display the top 5 and {}

#

i mean data

amber fractal
#

well wait a sec, Im a bit retarded

empty owl
#

its fine

#

ill ask the official quick db server

amber fractal
#

Best to, I dont use that mmLol

crisp sluice
#

hi

#

Is there someone who understands the coding?
Would I ask something?

void mantle
#

what language :?

crisp sluice
#

hm

blazing star
#

and what code

crisp sluice
#

discordjs

blazing star
#

the file does not exist

crisp sluice
#

which file
?

blazing star
#

the file you are trying to get data from does not exist

crisp sluice
#

ty

blazing star
#

ok

crisp sluice
#

😃

late hill
#

@uneven laurel maybe because the message was sent in DM, so there is no guild?

earnest phoenix
#

@sterile hearth

sturdy delta
#

Would this work?
If(message.channel.type == dm)
{
Message.channel send(‘this command doesn’t work in DIREct messages’)
Return;
};

desert bough
#

discord.js?

sick cloud
#

use a codeblock

#

and no it'd throw errors

desert bough
#

yeh it would

#

just saw what was wrong

keen drift
#

prob not