#development

1 messages ยท Page 826 of 1

modest maple
#

in understandable terms?

lyric mountain
#

hi make register in discord api that is the errors
I'm dad

slender thistle
#

Whatever you are doing, stop doing it so much that you are being ratelimited

modest maple
#

if that was one message that was gonna get a star

#

but because u sent two

#

no star

lyric mountain
#

no probs

golden condor
#
(node:217) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'size' of undefined

    at DBLAPI.postStats (/rbd/pnpm-volume/1e1e1444-03f1-4064-9b93-66c118075417/node_modules/.registry.npmjs.org/dblapi.js/2.4.0/node_modules/dblapi.js/src/index.js:149:79)

at DBLWebhook.<anonymous> (

:7)

    at DBLWebhook.emit (events.js:196:13)

    at DBLWebhook._emitListening (/rbd/pnpm-volume/1e1e1444-03f1-4064-9b93-66c118075417/node_modules/.registry.npmjs.org/dblapi.js/2.4.0/node_modules/dblapi.js/src/webhook.js:40:10)

    at Object.onceWrapper (events.js:284:20)

    at Server.emit (events.js:196:13)

    at emitListeningNT (net.js:1260:10)

    at processTicksAndRejections (internal/process/task_queues.js:83:17)

    at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:58:3)

    at Function.Module.runMain (internal/modules/cjs/loader.js:828:11)

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

(node:217) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.``` Get this error when I have ```js
dbl.webhook.on('ready', hook => {
  console.log(`Discord Bot List Webhook is running at http://${hook.hostname}:${hook.port}${hook.path}`);
  dbl.postStats(client.guilds.size)
});```
lyric mountain
#

lol programming in cellphone

earnest phoenix
#

That is perfect yes or no

slender thistle
#

The fact that you sent a password

modest maple
#

holy fucking shit

#

why

slender thistle
#

and you using fingerprints

golden condor
#

What password?

slender thistle
#

Pretty shady

modest maple
#

why are you trying to build a api wrapper

#

when using

slender thistle
#

Is that a goddamn selfbot

modest maple
#

that basic code

golden condor
#

Who are you talking to???

modest maple
#

on a phone

#

the kid who's trying to self bot

#

not u

#

dw

golden condor
#

OK

#

I was worried as heck there

lyric mountain
#

yep, selfbot

golden condor
#

Hold on

marble juniper
#

who is a selfbot

golden condor
#

Before you make any accusations

lyric mountain
#

actually, I don't even know what he's trying to achieve

earnest phoenix
#

@slender thistle bro I want to talk in dms

modest maple
#

not only is it breaking discord ToS but its not even coded well pandasad

golden condor
#

Try and see if he actually is

marble juniper
#

who is a selfbot

wet ferry
#

Hi all! I'm getting a "Error: Shard 1's Client took too long to become ready." error as well as a weird guild leave event "Shard 1 โžœ Left a guild called undefined!" from one of my shards. Do you have any idea what could be causing this? It's not a ban, because I got no email, and I get the same error from my computer. What could be causing this? DJS version 11.6.2

golden condor
#

You can't prove if he is or not

slender thistle
#

Why do you want to talk in DMs

golden condor
#

My error is fixed now

#

yay

marble juniper
#

bruh

lyric mountain
#

he's clearly logging in with an account

#

but the hard way

earnest phoenix
#

just I need fix my erore

modest maple
#

not even good coding

slender thistle
#

We don't support violating Discord ToS here

golden condor
#

If you were gonna self bot, at least do it right

marble juniper
#

btw I have a help command but im getting this error

golden condor
#

smh

marble juniper
#

It worked fine when I was running it locally

golden condor
#

Need more than that mate

marble juniper
#

on glitch tho it gets errors

#

ik

#

Im sending code

earnest phoenix
#

Ok sorry bro

golden condor
#

glitch ayyyyyy

modest maple
#

he deleted his image

#

rippp

marble juniper
#
const { MessageEmbed } = require("discord.js");
const { stripIndents } = require("common-tags");

module.exports = {
    name: "help",
    category: "Info",
    description: "Shows you all existing Commands or Info about one single Command",
    usage: "[Command]",
    run: async (client, message, args) => {
        if (args[0]) {
            return getCMD(client, message, args[0]);
        } else {
            return getAll(client, message);
        }
    }
}

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));
}

function getCMD(client, message, input) {
    const embed = new MessageEmbed()

    const cmd = client.commands.get(input.toLowerCase()) || client.commands.get(client.aliases.get(input.toLowerCase()));

    let info = `No information found for command **${input.toLowerCase()}**`;

    if (!cmd) {
        return message.channel.send(embed.setColor("RED").setDescription(info));
    }

    if (cmd.name) info = `**Command name**: ${cmd.name}`;
    if (cmd.aliases) info += `\n**Aliases**: ${cmd.aliases.map(a => `\`${a}\``).join(", ")}`;
    if (cmd.description) info += `\n**Description**: ${cmd.description}`;
    if (cmd.usage) {
        info += `\n**Usage**: ${cmd.usage}`;
        embed.setFooter(`Syntax: <> = required, [] = optional`);
    }

    return message.channel.send(embed.setColor("GREEN").setDescription(info));
}
modest maple
#

snipe time me thinks

marble juniper
#

thats the command

earnest phoenix
#

Sorry

lyric mountain
#

nah, let him be

modest maple
#

you will get banned

golden condor
#

pls snipe

modest maple
#

just btw

#

if you make that self bot

golden condor
#

ooooof

marble juniper
#

and it seems to be happening on the message.channel.send

modest maple
#

not only from here but from discord

golden condor
#

Bro

#

Just set the embed colour in the actual embed

#

Underneath messageembed type .setColor("GREEN")

lyric mountain
#

actually, that selfbot is programmed so bad that it'll be a miracle if he even sent a message with it

#

but still, don't make one

earnest phoenix
#

I need help how to get role all discord members

golden condor
#

No

#

Don't make one

#

It's highly against ToS of discord

lyric mountain
#

bots are easier, better faster and stronger

#

selfbots are clunky, volatile, limited and forbidden

#

also you can't bulk retrieve anything with selfbots

golden condor
#

Yeah

#

Plus, bots give you someone to talk to when you are lonely (lmao)

lyric mountain
#

holy

#

no

#

titles and footers only accept text

golden condor
#

169

lyric mountain
#

lol there's a serious memory leak there

golden condor
#

What could be causing it?

sudden geyser
#

it could be anything.

lyric mountain
#

^

golden condor
#

I have lavalink music

#

And this is my package.json

#
{
  "name": "bot",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "author": "Cxllm",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^11.6.1",
    "express": "^4.17.1",
    "express-glitch-keepalive": "^0.2.0",
    "simple-youtube-api": "^5.2.1",
    "ytdl-core": "^2.0.0",
    "random-puppy": "^1.1.0",
    "moment": "^2.24.0",
    "superagent": "^5.2.2",
    "parse-time": "^0.1.4",
    "moment-duration-format": "^2.2.2",
    "cheerio": "^0.22.0",
    "urban": "^0.3.2",
    "fs-nextra": "^0.4.7",
    "hastebin-gen": "^2.0.5",
    "yql": "^1.0.2",
    "mathjs": "^6.6.1",
    "tinyurl": "^1.1.3",
    "node-superfetch": "^0.1.10",
    "discord.js-lavalink": "^2.2.3",
    "lavalink": "^2.9.0",
    "quick.db": "^7.0.0-b22",
    "node-opus": "^0.3.2",
    "ffmpeg-static": "^4.0.1",
    "weather-js": "^2.0.0",
    "random-facts": "^1.0.6",
    "uuid": "^7.0.2"
  },
  "repository": {
    "url": "stuff"
  }
}```
sudden geyser
#

oh my

split hazel
#

Do you even use all of those packages

golden condor
#

Yes

#

I think so

#

These four I am not sure abaout

copper cradle
#

oof

golden condor
#

"superagent": "^5.2.2",
"parse-time": "^0.1.4",
"moment-duration-format": "^2.2.2",
"cheerio": "^0.22.0",

copper cradle
#

remove them

#

and if your code breaks

#

then

lyric mountain
#

if it breaks return them

golden condor
#

That's what I did

#

I ain't doing that ever

zenith terrace
#

An answer

golden condor
#

Lmao

blissful scaffold
#

SyntaxError: Unexpected token

golden condor
#

Rest of code?

#

@earnest phoenix Mine is fine like this

#

function play(guild, song) {

blissful scaffold
#

check what the ^ points at

golden condor
#

I will check my ytdl code

#

Hold on

#

I have ytdl and lavalink don't judge me

#

Still looks like this

#

function play(guild, song) {

grizzled raven
#

my bot has a channel in client.channels, but not in the actual guild itself, what went wrong? doing client.channels.get("12345").guild.channels.get("12345") returns undefined

lyric mountain
#

wait

#

wat

stiff sedge
#

find doesnt even exist

lyric mountain
#

my bot has a channel in client.channels
ok, so your bot is trying to search for a channel

but not in the actual guild itself
define that

client.channels.get("12345").guild.channels.get("12345") returns undefined
why not use client.guilds.get("98765").channels.get("12345")?

grizzled raven
#

thats the exact same thing

#

i mean

lyric mountain
#

no it's not

slender thistle
#

Ehh

lyric mountain
#

if client.channels.get("12345") returns null then the rest will be null

grizzled raven
#

well it doesnt work anyway

hollow granite
#

why doesnt this work anymore
@stiff sedge

I think in like v12 you have to use:
msg.guild.emojis.chache.find(r => r.name == emojiname[n])

grizzled raven
#

and client.channels.get("12345") isnt null, but guild.channels.get("12345") is

slender thistle
#

But then wouldn't null.guild return an error

lyric mountain
#

it'd return undefined afaik

slender thistle
#

So then null.undefined.channels

lyric mountain
#

probably with an error somewhere

slender thistle
lyric mountain
#

anyway

#

I'm trying to understand what he meant

#

@grizzled raven what are you trying to do?

#

in 5 words or less

grizzled raven
lyric mountain
#

why are you getting the same channel twice anyway?

grizzled raven
#

im not

lyric mountain
#

like, client.channels.get(ID) gets the channel

grizzled raven
#

im just saying that the channel isnt logged in guild.channels

lyric mountain
#

so what's the issue?

grizzled raven
#

im just saying that the channel isnt logged in guild.channels
@grizzled raven

lyric mountain
#

but what's the issue? what are you trying to accomplish?

grizzled raven
#

why isnt it logged in guild.channels

restive furnace
#

@golden condor ur problemo might be cause u host lavalink on glitch atleast what i can see from logs

grizzled raven
#

only one channel is logged in guild.channels

golden condor
#

I don't host the node

lyric mountain
#

ok, I understood that, but WHAT is the issue?

golden condor
#

I just run the music

grizzled raven
#

i

lyric mountain
#

do you really need to get the guild from a channel retrieval then the the channel again?

#

just use client.channels.get(ID)

grizzled raven
#

no because messages arent being cached in that channel

#

and that isnt normal to begin with

lyric mountain
#

what about client.channels.cache.get(ID)?

#

if you're using d.js v12 then this was one of the changes

grizzled raven
#

if im using client.channels.get and it works, im not using djs12

#

im on v11 lol

lyric mountain
#

lol I still don't get what's your issue

#

if im using client.channels.get and it works, im not using djs12
if it works why not use it?

#

can someone help me with this?

grizzled raven
#

a

#

i mean

#

client.channels.get means im using v11

#

im saying im using v11

lyric mountain
#

ok

grizzled raven
#

im saying im not using v12

lyric mountain
#

ok ok, I get that

#

proceed

grizzled raven
#

yes

#

should i proceed backwards and repeat what i already said?

#

no because messages arent being cached in that channel
@grizzled raven

#

and that isnt normal to begin with
@grizzled raven

lyric mountain
#

start by stating exactly what you're trying to accomplish and what issue you're having

grizzled raven
#

only one channel is logged in guild.channels
@grizzled raven

#

why isnt it logged in guild.channels
@grizzled raven

lyric mountain
#

only one channel is logged in guild.channels
...
why isnt it logged in guild.channels
WHAT isn't logged in guild.channels?

grizzled raven
#

12345

#

and every other channel except one, that was just an example

quartz kindle
#

so theres only one channel missing?

#

and its not a deleted channel?

grizzled raven
#

no only one channel there

lyric mountain
#

thank god tim came

zenith terrace
#

Im confused on whats happening

quartz kindle
#

there is only one channel in the guild cache?

zenith terrace
#

All I see are quoted messages

grizzled raven
#

yes

quartz kindle
#

dafuq

grizzled raven
lyric mountain
#

your turn guys

slender thistle
#

dafuq
Yup, the situation is FUBAR

zenith terrace
#

I dont think you should put .id at the end

grizzled raven
#

i jusg put id for demonstration

#

to show it exists there

zenith terrace
#

Oh

lyric mountain
#

what I understood until now:

He's having issues retrieving a channel with client.channels.get(ID).guild.channels.get(ID), but stated that client.channels.get(ID) works.

For some reason, he refuses to use the working method

grizzled raven
#

client.channels.get().guild is just me getting that guild

quartz kindle
#

it has nothing to do with that

zenith terrace
#

So what are you trying to do with it?

lyric mountain
#

it's v11 btw

zenith terrace
#

client.guild.channels.find(channel => channel.id=== "ID");

quartz kindle
#

there are two channel storages in discord.js: client.channels which contains ALL channels including DMs, and guild.channels which includes channels specific to that guild

stiff sedge
#

@hollow granite it worked, thanks

quartz kindle
#

the issue is that a channel is present in one store, but not in the other, which should always be in both

zenith terrace
#

Am I correct on the code Tim?

stiff sedge
lyric mountain
#

wrong variable type

stiff sedge
#

its just var

lyric mountain
#

it must be either a string or GuildEmoji/ReactionEmoji

stiff sedge
#

i tried like ๐Ÿ‘๏ธ

lyric mountain
#

that's an array

#

use var emojiname = ":eye:"

tight plinth
#
let seconds = video.length_seconds%60
        seconds = seconds < 10 ? "0"+seconds : seconds
        const minute = Math.round(seconds/60,0)
        const song = {
          id: video.id || video.video_id,
          title: video.title,
          url: video.video_url || "https://www.youtube.com/watch?v=" + video.id,
          duration: `${minute}:${seconds}`,
          author: {
id: message.author.id,
username: message.author.username
}
        }
``` duration is always 'NaN:NaN'
discordjs v12, ytpl, ytdl-core
true ravine
#

Just a quick question - are you not allowed to change font color in css for the top.gg website?

tight plinth
#

you are

true ravine
#

For some reason it isn't working

#

But thanks

stiff sedge
tight plinth
#

===

#

and const n

finite bough
#

@elder moss wrong channel

stiff sedge
#

it still doesnt work..

#

heres whole code

stiff sedge
finite bough
#

@stiff sedge any errors?

true ravine
#

@lyric mountain Wasn't planning on either of those so thanks xd

grizzled raven
#

yeah what tim said

stiff sedge
#

emoji must be a string

#

but i need a list

lyric mountain
#

@stiff sedge weren't you supposed to use if (reaction.emoji.name === n)?

grizzled raven
#

and i think because the channel isnt stored in guild channels, the bot doesnt recieve messages there

lyric mountain
#

since you're iterating on every index in that array and getting the value

grizzled raven
#

also, no, emojiname[n] gets the value, n is uust a number

lyric mountain
#

I see

#

try printing emojiname[n] to the console

#

see what it's outputting

quartz kindle
#

@grizzled raven i have no idea why the channel wouldnt be there, but you could try adding it yourself

#

guild.channels.set(id,channel)

tight plinth
#

with js, how can I check if a yt video is invalid (private, deleted...)?

lyric mountain
#

http request it

#

the video will return a error code if it was deleted or is private

shadow shale
#

Hello i need help i want to make a total members count in python

#

Please help ping me when answer

slender thistle
#

Either client.users if you are caching everything or sum of a list that contains guild.member_count of each of your bot's guild

shadow shale
#

In python?

slender thistle
#

Yup

earnest phoenix
#

what I said in general, a solution isn't really necessary I just want to see if anyone else at all is experiencing a similar thing because my friend said his bot takes a hell of a long time to login too

shadow shale
#

@slender thistle thank you so much yooure the BEST!!

outer niche
#

Can I use a Discord web hook or do I need to create my own with the website

true ravine
#

For what purpose?

outer niche
#

Posting votes

modest maple
#

you mean getting votes?

outer niche
#

Yes

modest maple
#

receiving votes is nothing todo with discord webhooks

#

its just a method used for dbl to send u the votes

#

if u mean how can i post it using webhooks

outer niche
#

Yes

modest maple
#

u then have to have a seperate system using discord's webhooks

outer niche
#

Ok

copper cradle
#

@stiff sedge use of

#

not in

#

in returns an index

#

of returns the thing itself

naive mantle
#

hey so

#

im making a bot

#

and i need to know how my command

#

has to be the exact message

#

because i dont like how message.content.includes works

#

im using djs 11

lyric mountain
#

you what?

#

use String.startsWith()

naive mantle
#

yea but then anything after will still run the command

#

i want it to be that exact message

lyric mountain
#

then message.content === themessage

naive mantle
#

as an if command?

#

so like


if message.content === themessage {
message.reply("message")
};```
lyric mountain
#

by "themessage" I mean the actual string to check

naive mantle
#

i know

#

but thats what the code is correct

#

wait is it

#

bot.on("message", (message) => {
    if (message.content === ("themessage")) {
        message.reply("message")
        };
});```
#

@lyric mountain

lyric mountain
#

pretty much

naive mantle
#

aight

#

ty

lyric mountain
#

it'll only run if someone says themessage

naive mantle
#

yea ill change it to my command

lyric mountain
#

btw, no need for the extra ()

naive mantle
#

oh there isnt

#

ok

lyric mountain
#

and you might want to make a command manager, else it'll be hard to add or modify commands later on

naive mantle
#

so just ```java
if (message.content === "themessage") {

#

whats a command manager

#

lol sorry im new to java

#

ive only done lua before

true ravine
#

Basically you have loads of separate files, each one containing code for one command. When someone uses a command, the code from the file is used.

#

It helps to split code up into readable chunks

naive mantle
#

are you saying i have to have one manager file, then one for each command and program the manager to start those other files whenever i use node .?

lyric mountain
#

lol sorry im new to java
@naive mantle wait, java?

naive mantle
#

yes im using java for my bot why

lyric mountain
#

then everything is different

naive mantle
#

frick.

true ravine
#

Do you mean javascript or java?

naive mantle
#

javascript

lyric mountain
#

meh

naive mantle
#

javascript javascript

true ravine
#

Ah that's alright then

naive mantle
#

they are different?

lyric mountain
#

javascript IS NOT java

true ravine
#

Yeah very

naive mantle
#

wow

true ravine
#

I use javascript so...

naive mantle
#

anyway how do i run other files from one big file

lyric mountain
#

it's like comparing a skyscrapper with a porsche

naive mantle
#

oop

lyric mountain
#

anyway how do i run other files from one big file
@naive mantle you import them

true ravine
#

Basically you have one file called something like index.js and inside there is some code - a part of this code imports all the files for you

naive mantle
#

i have index js

#

whats the code that imports

true ravine
#

Yeah so in there you just need like 5 lines of code and that imports them all

lyric mountain
#

import * from ('./yourotherfile.js')

true ravine
#

But it depends how you want to set up the command manager

shadow shale
#

Hello how can i make command server-side in python... So it can be used in multiple servers

naive mantle
#

so like

lyric mountain
#

Hello how can i make command server-side in python... So it can be used in multiple servers
@shadow shale you need a database

naive mantle
#

i would say import * from ('./command.1.js') implying my file is named command.1.js?

lyric mountain
#

and all commands are server-side

#

because there's no "bot client application"

shadow shale
#

I have suggestion system that saves channel id only for that and if i run it in another server it makes the suggestion id in that saved...

#

And when anyone change the channel id it will rewrite it

naive mantle
#

@true ravine import * from ('./command.1.js') if my file was named command.1.js right

lyric mountain
#

and in the same folder

naive mantle
#

they have to be in the same folder?

lyric mountain
#

And when anyone change the channel id it will rewrite it
@shadow shale you need a database to store configs per guild

shadow shale
#

In python

#

?

lyric mountain
#

they have to be in the same folder?
@naive mantle no, but './afile.js' means that afile.js is in the same folder

shadow shale
#

How tell me

lyric mountain
#

./ is the same folder

naive mantle
#

ok

shadow shale
#

Tell me how to make the database

naive mantle
#

and that would import the code from that file into the command manager file?

lyric mountain
#

can you wait?

#

patience plz

naive mantle
#

sorry

lyric mountain
#

not you

naive mantle
#

oh

shadow shale
#

Ok im patience

true ravine
naive mantle
#

no i cant use that

lyric mountain
#

@shadow shale independent of language, you need some kind of database (like PostgreSQL, SQLite, MySQL, etc)

#

no i cant use that
@naive mantle why?

naive mantle
#

im using d.js version 11 thats all version 12

true ravine
#

It works the same

naive mantle
#

a lot of the code works have changed

true ravine
#

Trust me I set my command handler up on v11.5 and it works

#

Using that guide

naive mantle
#

me too

lyric mountain
#

if your code is small, I'd recommend to start using v12 right away

naive mantle
#

aight so im gonna test the import out

#

ive tried v12 a lot of the code is harder for me than in v11

lyric mountain
#

but one day you'll have to migrate it due to becoming obsolete

#

and it's better to migrate while small

true ravine
#

As far as I can see nothing in the guide I linked involves code that differs between v11 and v12

#

The guide is your best bet

naive mantle
true ravine
#

Yeah I'm aware of that I'm updating my code to v12 now

#

Just use the guide it still works

naive mantle
#

yeah but like, the guide is hard for me to understand

true ravine
#

Copy and paste code then

naive mantle
#

const Discord = require('discord.js');
const bot = new Discord.Client();

bot.on("message", (message) => {
    if (message.content.includes(";ping")) {
        message.reply("Pong!");
    }
});

bot.on("message", (message) => {
    if (message.content.includes(";serverinfo")) {
        message.reply("\n**server.id** - 656140730963853321 \n**server.name** - [ScD] Scientific Department \n**server.memberCount** - 28 \n**server.ownerID** - 350788382026235905 \n**server.createdAt** - Mon, Dec 16, 2019 9:29 AM");
    }
});

bot.on("message", (message) => {
    if (message.content.includes(";cmds")) {
        message.reply("\n``Command List`` \n`Prefix:` **;** \n \n**serverinfo** - Gives the server information. \n**ping** - Fun command, bot says `Pong!` \n**coinflip** - Flips a coin. \n**cmds** - Sends this command list.");
    }
});



bot.on("message", (message) => {
    if (message.content === "themessage") {
    var array = ['heads','tails']
    var choice = array[Math.floor(Math.random() * array.length)]

    if (message.content.includes(";coinflip")) {
        message.reply(`It's ${choice}!`);
    }
};
});```
#

thats all my code

true ravine
#

It's probably the best resource out there aside from the discord.js docs

naive mantle
#

would that be hard to transfer?

true ravine
#

Not at all

#

Pretty sure none of your code involves things that changed in v12

naive mantle
#

nice ok

#

ima just convert that then

true ravine
#

Good plan

naive mantle
#

its npm init --save discord.js

#

right

true ravine
#

You need to uninstall your current discord.js then re install

naive mantle
#

i did

#

uninstall already

#

everything in recycle bin now

lyric mountain
#

lol wat

naive mantle
#

its deleted

#

i deleted all of the discord.js code

#

out of recycle bin

lyric mountain
#

wait

#

to uninstall all you have to do is npm uninstall discord.js

#

not manually delete anything

naive mantle
#

lol ive been doing it the hard way then lmao

#

the only reason i used v11 is because it used cmd and not powershell

shadow shale
#

Thank you @lyric mountain thanks for your help

lyric mountain
#

the only reason i used v11 is because it used cmd and not powershell
@naive mantle the terminal you used shouldn't matter

#

like, powershell is pretty much a cmd v2

naive mantle
#

all of my tutorial vids said powershell was harder

#

oh ok

lyric mountain
#

powershell is just a cmd with more features

elder moss
#

I'm trying to look for a job but I can't find one who can help?

naive mantle
#

npm init --discord.js@12.0.0 or has it been updated a more recent version

#

@elder moss this is for help about making a bot not asking to be recruited

earnest phoenix
#

v12.0.2 has been released

naive mantle
#

ok

elder moss
#

@naive mantle but atleast give me some suggestions

naive mantle
#

i dont have any

grizzled raven
#
let h
var h
naive mantle
#

im a pupil of code let alone could I teach

lyric mountain
#

@elder moss

grizzled raven
#

nvm lol

elder moss
#

@lyric mountain there's only 3

#

I already asked them so yh

lyric mountain
#

well, those are the only ones I know of

naive mantle
#

kuu it says npm ERR! 404 'create-discord.js@12.0.2' is not in the npm registry.

lyric mountain
#

unless you live in brazil, but I guess you don't

elder moss
#

Thanks anyway

lyric mountain
#

@naive mantle npm install discord.js

elder moss
#

@lyric mountain are they office jobs in Brazil like you need to be in a office?

naive mantle
#

@lyric mountain i used npm init --save discord.js@12.0.2

#

wait

#

i forgot the v

earnest phoenix
#

just do npm i discord.js

#

lol

naive mantle
#

ok

#

done its downloading

lyric mountain
#

@elder moss there are homeoffice jobs, but you'd need to search for them

#

but why look for them in such country?

#

like, probably in NA there're better options

elder moss
#

I don't have the money right now but I just need more money to move to a different country

#

So if its a home officer and I'm like a different country it doesn't really matter as a long as I'm in contact with them that's all that matters

#

Office*

lyric mountain
#

pro-tip: you don't want to come to brazil, not with its current finnacial situation

#

dollar at R$ 5,00

elder moss
#

Oh

#

My

lyric mountain
elder moss
#

Yh

naive mantle
#

holdup

#

npm ERR! 404 'create-discord.js@latest' is not in the npm registry.

#

@lyric mountain

lyric mountain
#

do the following:

naive mantle
#

i said npm init discord.js

lyric mountain
#

create a new folder

#

and do npm init

naive mantle
#

k

lyric mountain
#

then npm i discord.js

#

this will make a clean project

naive mantle
#

why cant i use my old folder

lyric mountain
#

then transfer your code to it

#

why cant i use my old folder
@naive mantle you can, but it's not worth the hassle since your code is still small

naive mantle
#

ok

#

ight its downloading now

#

@lyric mountain i got another error message

#

i said npm init

lyric mountain
#

which one?

naive mantle
#

then i said npm init discord.js after i said yes

lyric mountain
#

just dont

naive mantle
#

dont what

shadow shale
#

Do anyone know how to make AI chatbot? If yes ping me

lyric mountain
#

do it in this exact sequence:
npm init
npm i discord.js

naive mantle
#

ok

lyric mountain
#

Do anyone know how to make AI chatbot? If yes ping me
@shadow shale define AI

shadow shale
#

Artificial inteligence

#

Like us humans

modest maple
#

sigh

shadow shale
#

Self learning machine

lyric mountain
#

ok, I'll try to explain

naive mantle
#

are you talking about the thing that dyno does

shadow shale
#

Please in my dms explain

naive mantle
#

like you can setup to have a response to certain messages?

shadow shale
#

I dont want find the text in here tommorow

modest maple
#

or do u mean

#

AI AI

lyric mountain
naive mantle
#

cuz that would be hard

lyric mountain
#

making a true AI is almost impossible

shadow shale
#

like you can setup to have a response to certain messages?
@naive mantle ik but thats not fun

vestal star
#

What hosting should I use for under $5?

naive mantle
#

are you talking about a vps

vestal star
#

Yes lol

naive mantle
#

my friend has one

#

dm @earnest phoenix

lyric mountain
#

What hosting should I use for under $5?
@vestal star contabo

modest maple
#

it litterally wouldnt be viable to have a true AI chatbot

vestal star
#

Ok

naive mantle
#

wait no

#

lasted

modest maple
#

the processing power needed

vestal star
#

What?

modest maple
#

is insane

naive mantle
#

its 5000 mb for 10$ a month

lyric mountain
#

that's why it's near impossible

modest maple
#

ive used machine learning to get it somewhat near

vestal star
#

Cantabo had better specs I think

modest maple
#

but that was weeks of training

earnest phoenix
#

It's private and not renting it atm

naive mantle
#

oop

vestal star
#

I'll check contabo, then if your hosting works for me I'll dm you

modest maple
#

contabo really good specs for the cost

lyric mountain
vestal star
#

How is contabo so cheap?

modest maple
#

scale

#

lots of users

#

so cheaper prices

vestal star
#

Oh

lyric mountain
#

they are pretty much the #1 vps service

modest maple
#

their dedi prices arent that bad either tbh

vestal star
#

But why does Google cloud not have such low prices if they have so many costumers?

lyric mountain
#

so lots of customers + lots of money * actually good CEO = great service

#

contabo actually cares for their customers

#

like, you could eat pizza with them

vestal star
#

Oh okay, next what plan should I use, that's under $5 usd

lyric mountain
vestal star
#

Ok

lyric mountain
vestal star
#

I'll do that one ๐Ÿ‘Œ

#

Maybe.

prime cliff
#

The 300GB storage is good for websites or image storage too which is what i use it for

quartz kindle
#

contabo's prices are ridiculous

#

it feels like a scam

lyric mountain
#

lol yeah

quartz kindle
#

but somehow it isnt

#

but theres bound to be a catch somewhere

lyric mountain
#

even the page's style seems like a scam

naive mantle
#

@lyric mountain

#

im trying to import

#

like this

#

import * from('./command.1.js')

#

and it keeps saying as and from expected

lyric mountain
#

are you concatting?

#

import * from ('./command.1.js')

not

import * from('./command.1.js')

naive mantle
#

isnt that the same thing

lyric mountain
#

I don't think so

quartz kindle
#

from what i've heard, the reason contabo is so cheap is that their cpus are shared and not dedicated, and their ram is possibly a virtualized ssd lmao

naive mantle
#

so what code do i say

lyric mountain
#

still a good business model

#

@naive mantle

naive mantle
#

ok

quartz kindle
#

import x from y is not supported by default in node.js afaik

#

unless you enable the experimental flag

lyric mountain
#

ah

quartz kindle
#

or unless you're using typescript

naive mantle
#

im using import * from('./command.1.js')

#

am i supposed to replace * with something

quartz kindle
#

are you sure your code supports that kind of imports?

naive mantle
#

its the latest version of discord.js

#

so yes, it should

quartz kindle
#

its not a discord.js thing

#

its a node.js thing

naive mantle
#

im trying to import files from my folder but i dont know what code to use

quartz kindle
naive mantle
#

im using visual studio

quartz kindle
#

the import syntax is available starting from node.js v13.2

naive mantle
#

i have that

#

the latest one

#

which is like v15 or something

quartz kindle
#

there is no v15 lol

#

do node -v in your console

naive mantle
#

i just not i selected download current version

#

ok

#

v13.11.0

#

definitely have that

quartz kindle
#

ok, then check this and see if it works

naive mantle
#

kk

#

do i use

#

import * as name from "module-name";

#

@quartz kindle

quartz kindle
#

yes, try that

naive mantle
#

ok

#

in module name

#

would i put

#

./command.1.js

quartz kindle
#

yes

naive mantle
#

kk

#

it says

#

name is declared but its value is never read

#

@quartz kindle

mossy vine
#

thats a warning, you can ignore it

naive mantle
#

will my code still work

mossy vine
#

well the value is never read

naive mantle
#

i dont know what that means

#

all i need is for my import to work @mossy vine

#

im on a tight schedule someone please help

mossy vine
#

does it work now

naive mantle
#

no

viral spade
#

Hello i desperately need help!
I have 11 shards running with the ShardingManager of Discord.js.

Sometimes a certain shard wont come online and it says "Shard 5's Client took too long to become ready". Also if i restart, always the same shard wont come online.

Even if i let the program run, the shard will eventually retry to get ready, but again tell me that "Shard 5's Client took to long to become ready", in a loop.
Meanwhile i get errors from within the shard saying "bot.connect is not a function" or "Cannot read property prefix of undefined".

All other shards are running fine!
What can it be?

mossy vine
#

and what is the error

naive mantle
#

i have this

#

import * as cmds.js from "node_modules";

mossy vine
#

what do you want to do

naive mantle
#

import the code from those files into that file like a command manager

mossy vine
#

that is not how you do it

naive mantle
#

tell me how please

mossy vine
#

say this is your project structure

folder/
  file.js
index.js```
#

say file.js looks like this

#
module.exports.coolVariable = 'cool'```
#

in index.js you can do this

import * as coolThings from "./folder/file.js"

console.log(coolThings.coolVariable) // 'cool'```
naive mantle
#

my project structure is this

  index.js
  cmds.js```
mossy vine
#

or

naive mantle
#

theyre both in the folder

mossy vine
#
import { coolVariable } from "./folder/file.js"
console.log(coolVariable) // 'cool'```
naive mantle
#

what is coolVariable

#

can i name the variable whatever i want

mossy vine
#

of course

naive mantle
#

module.exports.variable

#

like that

mossy vine
#

yes

naive mantle
#

this doesnt make sense

mossy vine
#

how familiar are you with javascript

naive mantle
#

i literally started yesterday

mossy vine
#

then jumping into bot development may not be a good idea

naive mantle
#

thats the reason why i started javascript

#

ive been getting by fine

#

this is the only thing that stumped me

#

just let me explain

#

i have a folder named bot storage

#

in that folder, there is index.js and another file called cmds.js

#

cmds.js has a command for my bot in it

#

i want to import all of the code from cmds.js into index.js without having to type it all in index.js

#

how do i do that

#

@mossy vine

mossy vine
#

how do you define commands in cmds.js

naive mantle
#

the code in cmds.js is as follows:

#

bot.on("message", (message) => {
    if (message.content === ";cmds") {
       message.reply("\n``Command List`` \n`Prefix:` **;** \n \n**serverinfo** - Gives the server information. \n**ping** - Fun command, bot says `Pong!` \n**coinflip** - Flips a coin. \n**cmds** - Sends this command list.");
   };
});```
#

thats the only code

mossy vine
#

just to make it clear, you do not need a new bot.on for every command

naive mantle
#

i know

#

all i need is to import that code into index.js without having to type all of my commands in there so its easier to manage

mossy vine
#

at that point you might as well just write an actual command handler

naive mantle
#

thats what i need to do

naive mantle
#

tysm

quartz kindle
#

@viral spade there is an issue with the sharding manager apparently

viral spade
#

Oh man so its not really in my hands right now?
This is a very recent problem that might have a fix on the way?

quartz kindle
#

im not sure, i've seen people complaining about it for several days now, but only today someone posted an issue about it

naive mantle
#

@mossy vine wait, would it work if i said

//cmds.js
module.exports = bot.on("message", (message) => {
    if (message.content === ";cmds") {
       message.reply("\n``Command List`` \n`Prefix:` **;** \n \n**serverinfo** - Gives the server information. \n**ping** - Fun command, bot says `Pong!` \n**coinflip** - Flips a coin. \n**cmds** - Sends this command list.");
   };
});

//index.js

require("./cmds.js")```
quartz kindle
#

not only would that not work, its a terrible idea

naive mantle
#

i need someone to explain to me how to do this rather than give me a link and learn from that, often times its harder for my brain

quartz kindle
#

are you doing a command handler?

honest perch
#

i would make an embed

naive mantle
#

YES

#

i need someone

#

to explain to me

#

how i do a command handler

quartz kindle
#

so basically, step one: load all files in a folder

naive mantle
#

i already have that

quartz kindle
#

then for each file, require it and add it somewhere, like an object or a Map

naive mantle
#

how do i do that

quartz kindle
#

you can also attach it to the client for storing

#
client.commands = new Map();
let files = fs.readdirSync(...);
for(file of files) {
  let name = file.split(".")[0];
  let command = require("./folder/" + file)
  client.commands.set(name, command);
}```
#

now in your command files, you need to export a function

naive mantle
#

wait

#

do i have to do that

#

for every single

#

file

quartz kindle
#

no

#

thats in the main file

naive mantle
#

ok

quartz kindle
#

in your command files

#

you need to export a function

naive mantle
#

./folder/ shoulder be my folder name right

quartz kindle
#
module.exports = function(your arguments here, ie client or message) {
//  your command code here
}```
naive mantle
#

tim

#

do i change ./folder/ to my folder's name

quartz kindle
#

yes of course lol

naive mantle
#

ok

#

everything else stays?

quartz kindle
#

fill it up with whatever is relevant for you, like readdirSync(...)

#

the code is pretty much self explaining

naive mantle
#

what do i put there

#

i dont know what readdirSync(...) is for

quartz kindle
#

you said you already had that

copper cradle
#

uuh

quartz kindle
naive mantle
#

so my folder name?

quartz kindle
#

how did you do it before?

copper cradle
#

you shouldn't be doing this if you don't even know how loops work

viral spade
copper cradle
#

no

#

no

#

no

naive mantle
#

oh

copper cradle
#

that defeats the whole purpose of having a command handler

quartz kindle
#

anyways, fs is node.js's built in file system class, it contains all functions you need to access your local hard disk and files

#

fs.readdir is the function that reads all files in a folder

naive mantle
#

look i cant handle this with all you talking at the same time

quartz kindle
#

fs.readdirSync is the sync version of it

naive mantle
#

what do you mean by load all of the files in a folder

quartz kindle
#

ie

#

you have a folder called "commands"

#

and inside this folder you have several files

naive mantle
#

ok

quartz kindle
#

if you do fs.readdirSync("./commands")

#

it will give you the list of all files in that folder

copper cradle
#

dude

viral spade
#

maybe let him do the static version of folder structuring before loading commands dynamically from the files

copper cradle
#

why doesn't d.js come with a built in command framework

zenith terrace
#

Is the command handler the same in v12 as it is in v11?

copper cradle
dusky marsh
#

if you want that, use commando

quartz kindle
#

discord.js has commando for that

copper cradle
#

@zenith terrace yes

zenith terrace
#

Ok good

naive mantle
#

like that

copper cradle
#

yes but people don't use it

#

like

quartz kindle
#

@naive mantle yes

naive mantle
#

ok then in index js

quartz kindle
#

use fs.readdirSync()

#

with your folder name

grizzled raven
#

i thinl

quartz kindle
#

to get a list of files in the folder

naive mantle
#

client.commands = new Map();
let files = fs.readdirSync(...);
for(file of files) {
let name = file.split(".")[0];
let command = require("./folder/" + file)
client.commands.set(name, command);
}

#

that is what is in index.js right

grizzled raven
#

when he said he had all files in a folder loaded, i think he emant he had all files in a folder

quartz kindle
#

yes

copper cradle
#

uhh

#

when tim added ... inside of readdirSync he didn't mean you to literally paste it

naive mantle
#

this is what i have so far

#

client.commands = new Map();
let files = fs.readdirSync("./commands");
for(file of files) {
  let name = file.split(".")[0];
  let command = require("./folder/" + file)
  client.commands.set(name, command);
}```
copper cradle
#

yes

#

that's good

naive mantle
#

./folder/ do i change to ./commands again?

copper cradle
#

yes

naive mantle
#

ok

quartz kindle
#

unless you have a folder named "folder", then obviously yes

naive mantle
#

do i still keep the slash at the end

#

like ./commands/

grizzled raven
#

doesnt matter

naive mantle
#

ok

grizzled raven
#

personal preference i think

quartz kindle
#

in the require yes

#

because you're adding a file to it

grizzled raven
#

i think fs does it for you for folders

naive mantle
#

client.commands = new Map();
let files = fs.readdirSync("./commands");
for(file of files) {
let name = file.split(".")[0];
let command = require("./commands/" + file)
client.commands.set(name, command);
}

#

so that is in index.js

quartz kindle
#

for example, the variable file contains the name of the file, like botinfo.js

grizzled raven
#

oh there then yes

quartz kindle
#

if you dont put the slash there, it becomes ./commandsbotinfo.js

#

does that make sense?

#

nope

naive mantle
#

then do i put

module.exports = function(your arguments here, ie client or message) {
//  your command code here
}```
 in each of my command files
quartz kindle
#

yes

#

each of your command files will export a function

naive mantle
#

OK THIS MAKS SENSE NOW

#

TYSM

copper cradle
#

there u go

naive mantle
#

ive been trying to do this for like 2 hours

#

lmao

quartz kindle
#

but

naive mantle
#

wait what

copper cradle
#

iT bRoKe

naive mantle
#

OMG

#

I CANT DO THAT THEN?

quartz kindle
#

your events, ie client.on("message", => bla) should go in the main file, not in the commands

#

unless you want to make a specific file for events

viral spade
#

Tim thank you again for redirecting me to the discord.js github issues page with others with the same problem. You saved me a lot of time here..

quartz kindle
#

np, i've been seeing it happen for several days, idk why it took so long to post an issue

naive mantle
#

i frf

#

i gtg

#

and now i cant add it omg

copper cradle
#

lmao

quartz kindle
#

i dont use the shard manager myself, but what happened to me was that some specific guilds would randomly not arrive, or take ages to arrive

#

which caused the library to never fire the ready event lol

copper cradle
#

what do u use tim

#

a custom one ig

quartz kindle
#

internal sharding

copper cradle
#

ah yes

earnest phoenix
#

-รงal sa

quartz kindle
copper cradle
#

imagine

#

a green name

#

doing this

#

smh

viral spade
#

What is the preferred way of starting specific id shards with a shardingmanager (possibly even less ids, than there are totalShards, because the other ids will be started on another machine)?

quartz kindle
#

are you on v11 or v12?

slim heart
#

in nginx how can i make it so that if people are going to directly to /premium for ex, itll server the try_files that it should be trying, however any /premium/BLAH is proxy_passed somewhere else

copper cradle
#

yes

pale vessel
#

that is not helping

copper cradle
#

yes

snow urchin
#

On the emojiUpdate or EmojiCreate/Delete events, would the following work for getting the guild

client.on("emojiCreate", (emoji) => {
let guild_id = emoji.guild.id
})

discord.js v11.6.2

pale vessel
#

sure.

snow urchin
#

and what would trigger the emoji update event? I can only think of the emoji's name being changed that would trigger it

pale vessel
#

yeah

snow urchin
#

Aight

#

thanks

hidden spindle
#

Hey guys, whats the usual strategy when adding a command to the bot that takes params is?

#

something like - !addCommand 'hey its me' 'no its not'

summer torrent
#

args

hidden spindle
#

every !addCommand you write a json line?

#

yea but how do you save all the commands the users wrote

#

was thinking about creating a json with the commands, every addCommand adds a new line and etc

#

is that whats usually done?

pale vessel
#

a database

#

json is not good for storage

summer torrent
#

use mongodb

hidden spindle
#

was trying to avoid that since it wouldnt be many commands, but i guess ill have to settle one

#

thanks guys

pale vessel
#

yeah. a database is really important for these features

#

it speeds things up

snow urchin
#

Input

var { Logs } = require(`${process.cwd()}/src/Structures/Constants/Models.js`),
config = Logs.find({guildID: msg.guild.id}).then(items => items[0])
config

Output (model)

{
  channelUpdatesEnabled: true,
  channelUpdatesChannel: '689208139660525704',
  memberUpdatesEnabled: false,
  memberUpdatesChannel: 'Not Set',
  messageUpdatesEnabled: false,
  messageUpdatesChannel: 'Not Set',
  emojiUpdatesEnabled: false,
  emojiUpdatesChannel: 'Not Set',
  _id: 5e6ffcc7dc6f09247b38b655,
  guildID: '632641076850851862',
  __v: 0,
  guildChangeLogsChannel: '[#689239485325901904](/guild/264445053596991498/channel/689239485325901904/)',
  channelUpdates: [Object]
}

Why, when I do config.memberUpdatesEnabled, it returns undefined and the same for everything else.

snow urchin
#

I am probably just being stupid haha

#

but if someone could explain why i am stupid would be handy HA

valid holly
#

What permission lets people disconnect others in vc ?

earnest phoenix
#

move members

valid holly
#

thanks

#

They should mention it

hidden spindle
#

Guys, any idea why heroku might not find a module?

snow urchin
#

make sure it is included in the package.json

hidden spindle
#

its there

quartz kindle
#

if the package name is "node-cron" then require("node-cron")

#

but it seems like you're trying to use "cron" not "node-cron"

#

they are two different packages/libraries

snow urchin
quartz kindle
#

are you using mongoose?

snow urchin
#

yup

quartz kindle
#

actually

#

this would be more accurate

snow urchin
#

The solution is saying to make sure the field is in the schema, but I have already done that so I do not know what is up with it

quartz kindle
#

try this then

cerulean pebble
#

hmm why it's happen

snow urchin
#

When I use .toObject(), it converts it from model to an object, yet still does not work

quartz kindle
#

well you're using a promise and not awaiting it (i just noticed it now lol)

snow urchin
#

where haha, i must be blind tbh

quartz kindle
#

i mean, i dont use mongoose so idk what it returns, but if .find returns a promise, then yeah its not being awaited

#

it returns items in the callback, but not out of it

#
promise.then(something => {
  something exists here
})
something does not exist here```
#

so config would be Promise<pending> and config.whatever will indeed be undefined

#

if your eval supports async/await then do config = await Logs.find(...); config[0]

#

although mongoose is weird af so you never know

snow urchin
earnest phoenix
#

How do I make it so my bot filters swear words? @blazing fox needs info

quartz kindle
#

wont a self-invoking async function return undefined to the eval command itself?

#

unless the eval itself is async, it will always expect sync code only

earnest phoenix
#

@blazing fox

quartz kindle
#

try sending it as a message instead of returning it

earnest phoenix
#

Tim are you talking to me?

quartz kindle
#

to status

earnest phoenix
#

Ok

snow urchin
#

yep, love being called status :/

earnest phoenix
#

How do I make it so my bot filters swear words?

#

Ok Callum

quartz kindle
#

lul

snow urchin
#
const blocked_words = ["word1", "word2", "a bad phraseeee"]
blocked_words.forEach(blocked_word => {
if(message.content.toLowerCase().includes(blocked_word.toLowerCase())) {
// do things like delete the message or whatever haha
}
})

thats the beginner developer way i would do it @earnest phoenix HAHA

#

oh wait

#

i did blocked_words twice

#

like a nob

earnest phoenix
#

Whatโ€™s the proper one then

#

Can you send coz Iโ€™m a bit bad at this lol

snow urchin
#

^

#

above

earnest phoenix
#

Ok thanks

snow urchin
#

wait actually

#

ye the above is it now ๐Ÿ™‚

earnest phoenix
#

Oke thanks ,)

viral spade
#

What is the preferred way of starting specific id shards with a shardingmanager (possibly even less ids, than there are totalShards, because the other ids will be started on another machine)?

hidden spindle
#

Any idea why my discord bot token might be changing?

#

For some reason i always caught i rejection of token now

#

not sure what happened

#

(node:4) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.

unborn raft
#

was it reset? check your email

hidden spindle
#

ah fuck

#

token was compromised because ive uploaded to github

#

makes perfect sense

#

haha

#

ill have to check how to make a heroku env variable for this then

pale vessel
#

it should be fine unless your repository was public

hidden spindle
#

it was GWvertiPeepoCheer

astral yoke
#

How would I make a set prefix command for discord.js?

pale vessel
#

you need some form of a database

astral yoke
#

Mhmm

pale vessel
#

could it be quickdb, json (should be avoided) or sql

astral yoke
#

What would I make the database?

#

I'm guessing guildID and prefix?

pale vessel
#

correct

#

since you're using heroku, you need a remote database

astral yoke
#

a client-server database, im trying to look for one

#

any recommendations^?

pale vessel
#

any paid ones will do

#

make sure that the company has a good reputation

#

you don't want your database to get leaked

astral yoke
#

hm.

#

is there any other like hosting platform that supports sql database or does it have to deal with sql?

pale vessel
#

any web hosting company

#

/platform

#

the problem is that they would usually have a maximum concurrent connections

#

like 2 or 4

#

you need to use pools.

snow urchin
#
.setDescription(`<#${channel.id}> has been created by **${await executer("CHANNEL_CREATE", channel.guild.id)}`)
async function executer(type, guildID) {
    const audit = await client.guilds.get(guildID).fetchAuditLogs({type: type}).then(audit => audit.entries.first());
    return audit.executer;
}

#test has been created by **undefined

sudden geyser
#

Pretty sure it's .executor and not .executer

#

Also you're missing the markdown that makes the text bold at the end (**)

viral spade
#

What is the preferred way of starting specific id shards with a shardingmanager (possibly even less ids, than there are totalShards, because the other ids will be started on another machine)?

earnest phoenix
#

Guys what are some good moderation bots that can show user punishments and can do automod

snow urchin
#

Auttaja

sudden geyser
#

Dyno, Auttaja, etc. Search the site.

snow urchin
#
    const audit = await client.guilds.get(guildID).fetchAuditLogs({type: type}).then(audit => audit.entries.first());
    return audit.executor;

ok, so I have the above code in a function, calling it with ${await getExecutor("CHANNEL_DELETE", channel.guild.id)}, and it works and all, but sometimes, instead of giving returning the person who deleted the channel, it returns the previous one... why is that?

naive mantle
#

im not good in java

#

but

#

it nay have something to do with

#

may

#

await.entries.first());

snow urchin
#

...

#

that gets the latest one

#

and since its getting it, as soon as the channel is deleted, the latest one SHOULD be that action from the user that did that action

naive mantle
#

your getting the first thing in the audit log correct

#

and since this executes immediately as the channel is deleted it will be that

#

right?

snow urchin
#

yup

naive mantle
#

i don't think its wrong on your end

#

discord has been working slowly lately

#

lots of outages

#

and i think its deleting but not being sent into the audit log enough time

#

so your bot picks up the last person before that

#

when it actually goes into the audit log

snow urchin
wicked pivot
#

um is it ok to talk about coronavirus?

pale vessel
#

not here

naive mantle
#

not in here

snow urchin
#

Not here

#

ok discord lag

#

HA

wicked pivot
#

at least I develop something related to that, that poses problem?

naive mantle
#

yea cuz discord stinky

#

what is it

#

this is for development questions

#

not just talking about it

wicked pivot
#
let { body } = snekfetch.get("https://coronavirus-19-api.herokuapp.com/all")

      const classic = new Discord.RichEmbed()
     .setColor('#dc143c')
     .setTitle(`Stat du CoronaVirus`)
     .setDescription(`
> > Total :

> > Nombre de cas : ${body.cases}
> > Nombre de membre rรฉtablie : ${body.recovered}
> > Nombre de mort : ${body.deaths}`)
     
     .setFooter(`demande de ${message.author.username}`, message.guild.iconURL)
     .setTimestamp()``` I don't know why it doesn't work
naive mantle
#

wait no you can talk about dev here nvm

#

let me look

wicked pivot
#

"UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'cases' of undefined"

snow urchin
#

what do you get when you console.log(body)

wicked pivot
#

i will watch

pale vessel
#

why are you destructuring body?

wicked pivot
#

I get "undefined" wtf?

pale vessel
#

just let body would be ok

sudden geyser
#

snekfetch is deprecated

pale vessel
#

use node-fetch instead

snow urchin
#

^

naive mantle
#

I thought snekfetch was for images

sudden geyser
#

oh it's for a lot of things

naive mantle
#

oop

sudden geyser
#

but so is node-fetch/axios/request (deprecated)/got/etc.

pale vessel
#

nice api

naive mantle
#

i think it didn't recover cases from the http

wicked pivot
#

<node-fetch>.get ?
is it used the same way?

naive mantle
#

say

#

let body = node-fetch('link')

snow urchin
#

.json()

naive mantle
#

ive neve4 used .json

#

never*

wicked pivot
#

undefined Detente_ref

snow urchin
#
const fetch = require("node-fetch")
fetch(url)
.then(res => res.json())
.then(json => {
// json is reponse, json.cases would work etc.
})
#

thats how i do it ha

pale vessel
#

or use await

wicked pivot
#

thx

pine aspen
#

Hey.

#
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: /app/data/DiscordBot/node_modules/canvas/build/Release/canvas.node: invalid ELF header
    at Object.Module._extensions..node (module.js:682:18)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/app/data/DiscordBot/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
#

How could i fix this?

#

I tried reinstalling

#

and stuff

dusky marsh
#

in what context is this happening, like what are you doing to get the error

#

@pine aspen

pine aspen
#

I'm trying to run my bot.