#development

1 messages ยท Page 694 of 1

vital lark
#

um

#

why is node-fetch like this

knotty steeple
#

i agree

vital lark
#

@knotty steeple ๐Ÿค” maybe try this?

#

or am i wron

knotty steeple
#

sorry im too dum for that

vital lark
#

why r u programming if ur dumb

#

try r.headers.get('content-length')?

#

idk man

#

node-fetch is gay

knotty steeple
#

yes that works

#

when did they add that

#

now to figure out how to make a progress bar

knotty steeple
#

but obviously having it spam the console like this isnt really efficient is it

#

so how do i make it essentially edit the line

copper cradle
#
#

@knotty steeple

knotty steeple
#

arent you helpful?

#

i already figured it out myself btw

#

also do i have to specifically say that "googling that didnt work because the result i wanted wasnt the one i got" because thats what happened

#

which is why i asked here

copper cradle
knotty steeple
#

if you cant actually be helpful dont say anything

copper cradle
#

anything

#

I said it

knotty steeple
#

fuck off

loud salmon
#

:<

#

yall be nice to each other please

#

@copper cradle pls dont just tell people to google it

copper cradle
valid frigate
#

how do i actually get the amount of latency to the discord api in djs master

#

client.ping got removed

#

and apparently client.ws.shard.ping isnt actually accurate either

earnest phoenix
#

does anyone know how to play a playlist using discord.js

#

if yes, please dm the code to me.

amber fractal
#

@earnest phoenix we dont spoonfeed

#

Use arrays and shift

valid frigate
#

ah

#

is that just the latency to the api

amber fractal
#

It's the same as client.ping was I believe

valid frigate
#

all i need is a precise number lo

amber fractal
#

One sec

valid frigate
#

id assume

#

ws comes from client.ws.ping

amber fractal
#

well it's the average of all websocket shards

valid frigate
#

probably fine

amber fractal
#

Which I'd assume for you is 1?

valid frigate
#

yeah 1 shard

amber fractal
valid frigate
#

hmm

#

id say the average across all shards is fine

amber fractal
#

๐Ÿ‘Œ

valid frigate
#

thanks mate

knotty steeple
#

just make client.ping in current versions

floral bloom
#

Discord.js
How would I remove all reactions from a message? I'm having a bit of trouble with this.

#

Ping with response, please.

slender thistle
unkempt ocean
#

don't need anymore

unkempt ocean
#
module.exports.run = async (client, message, args, auth) => {
        console.log(auth)

auth is defined in main js

#

gets undefined

#

not like error

warm marsh
#

So code from main

unkempt ocean
#

wait a min

#

it exports message args client but not auth

warm marsh
#

you use, js commandFile.run(client, message, args, cmd, auth);

unkempt ocean
#

yeah

warm marsh
#

In your file you use client, message, args and auth

unkempt ocean
#

it runs commands with these right?

valid frigate
#

why is cmd defined in there

warm marsh
#

but auth is where cmd is.

#

@unkempt ocean You don't know how it works?

valid frigate
#

if you want to pass cmd just add that as a parameter to your function

unkempt ocean
#

I did it too xd

warm marsh
#

In your file that has command in it. You're going to need to use js module.exports.run = async (client, message, args, cmd, auth) => { console.log(auth); }

#

Although, Is there any need to pass cmd through?

#

you can get it from message doing message.content.split(/\s+/g)[0]

valid frigate
#

why would you use regex

#

you can just do the same with .split(" ")

warm marsh
#

Because people don't always use single spaces

valid frigate
#

then just ignore the command

#

it should*

warm marsh
#

Also, I started learning regex when learning JS so it kinda stuck.

valid frigate
#

ew regex

warm marsh
#

It's actually nice and useful.

valid frigate
#

people try to avoid it but it's inevitable

warm marsh
#

Yeah, Bot making doesn't really use it.

valid frigate
#

cough regex attacks

warm marsh
#

Meh.

valid frigate
#

the only problem i have with it is it's easy to deploy attacks on something that's supposed to parse regex

#

not in the context of bot making

warm marsh
#

Fair.

valid frigate
#

also readability

warm marsh
#

@unkempt ocean your best bet is to remove the cmd from .run() as you don't need it there and then try running your command.

#

How so?

#

I think it's easy to read.

unkempt ocean
#

it wasn't really helped my problem xd

valid frigate
#

for someone who doesnt know regex it's impossible to know what it does

warm marsh
#

Removing it from .run didn't help?

unkempt ocean
#

I just want to learn that can I use auth without defining again

#

with module.export

warm marsh
#

Yeah

#

Pass it in the .run()

unkempt ocean
#

it didn't work

warm marsh
#

Or you could bind it to message or the client.

valid frigate
#

can you send like

warm marsh
#

He already did.

valid frigate
#

all of your code

warm marsh
#

The useful stuff was sent.

valid frigate
#

thats wack

warm marsh
#

console.log message.content or args in your command and see if those log anything

valid frigate
#

if we provided the solution but it still doesnt work he needs to provide more context

unkempt ocean
#

I fix it

warm marsh
#

by doing?

unkempt ocean
#

it was really funny xd

#

don't know must have typed wrong I guess

warm marsh
#

Ok.

unkempt ocean
#

wait I need one more question

valid frigate
#

boi

warm marsh
#

Fire away.

unkempt ocean
#

I need to pass it run command right. Should do it for both

#

module export and run ?

#

I mean main.js and command.js

valid frigate
#

what

warm marsh
#

When you pass a variable as a parameter inside of commandFile.run()

valid frigate
#

you only have to do module.export.run in command.js

unkempt ocean
#

I can't explain myself sorry

valid frigate
#

and call run from index.js

warm marsh
#

Those can be used by the module.exports.run function only.

unkempt ocean
#

I got it

#

thank you both

warm marsh
#

No problem.

wooden lance
#

Getting this error or discordjs, tried updating literally everything, nothing seems to work. Anyone know what could be causing the problem?

/root/DiscordBotApp/node_modules/enmap/src/index.js:260
  static async migrate() {
               ^^^^^^^
SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/root/DiscordBotApp/node_modules/enmap/index.js:1:77)```
zealous veldt
#

That's not a discord.js error

#

Look at the stacktrace

#

It's an enmap error

wooden lance
#

Yes, it's a module.

zealous veldt
#

Does enmap have a support server?

wooden lance
#

yes actually lol. thinking i should be asking there.

unkempt ocean
#

prefix is different

#

I typed outputs after console.log parts

#

found it

small latch
#

@valid frigate Everything is attackable.

slow crypt
#

Can someone help me with if user perms?

knotty steeple
#
let args = [["o", "mayo"], ["tomato", "mayo", "mays"]]
let options = {}
for(let i = 0; i < args.length; i++) {
      options[args[i][0]] = args[i][1]
}
``` quick question how do i make this work for more than 2 elements in an array
#

cuz currently it will only take 2 stuff

#
{
    "o": "mayo",
    "tomato": "mayo"
}```
#

๐Ÿ‘€

amber fractal
#

What do you want the output to be?

knotty steeple
#

"tomato": "mayo mays"

amber fractal
#

Check if the array length is > 2?

#

Join all >=1 index with space?

#

So shift the array first then join mmulu

grim aspen
#

we all know my answer was wrong

#

nvm

amber fractal
#

Remember array.shift() returns the one item not the array

knotty steeple
#

i just did this ```js
if(args[i].length > 2) {
options[args[i][0]] = args[i].slice(1).join(" ")
}

#

lul

amber fractal
#

Well that works mmulu

knotty steeple
#

yes it does

viral spade
#

Hello,
If containerize and distribute my bot over multiple machines, will i be using 1. one container per machine with a sharding manager that spawns multiple instances of the bot or 2. spawn multiple instances of the bot in multiple containers?

i assume, because it is distributed, i will anyways have to tell each container/shardingmanager its id/ids. So am i right, it does not really matter if i send multiple ids to the shardingmanager or single ids to the single containers?

shut rose
#

I need change this:
return Math.floor(Math.random() * (max - min + 1)) + min;
because i want to make it consecutive no random

mossy vine
#

just.. increment?

viral spade
#

return min + 1;
?

#

or just min, you might skip by 2 otherwise

shut rose
#

look this is the all ocde

#

code

#

function randy(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

client.on('ready', async(message) => {
  client.setInterval(() => {
      let randInt = randy(0, 9);
      let canal = canal1[randInt];
      let channel = client.channels.get("621308997462523905"); //<-- pon el id de tu canal pa'ca

      channel.setName(canal);
  }, 10000);
});```
mossy vine
#

mmm api abuse

shut rose
#

what is api abuse?

knotty steeple
#

that code

mossy vine
#

quickly changing a channel name

shut rose
#

why

#

?

shut rose
#

but he changes in 10000ms

knotty steeple
#

still

mossy vine
#

that is very low

shut rose
#

a okay

knotty steeple
#

10secs

shut rose
#

a okay

#

i undertand

viral spade
#

make a command for it

shut rose
#

But how do I change the name consecutively, don't you aleatriamete?

#

But how do I change the name consecutively not randomly?

stray garnet
#

i have problem with guildMemberAdd event.
it dont sends any message

knotty steeple
#

code?

stray garnet
#

wait

mossy vine
#

while True
declare value

array[value]
value += 1
if value == array#length
    value = 0
knotty steeple
#

the code

#

ok

#

is waitingโ„ข

stray garnet
#
  const embed = new Discord.RichEmbed()
  .setDescription(`Welcome`)
  message.channel.send(embed)
})
knotty steeple
#

thats not how guildmemberadd works

stray garnet
#

how then lol

knotty steeple
#

the only param is member

#

to send to a channel you have to either get a specific channel or find a channel in the guild

#

like

member.send(`Welcome to the server!`)
#

you can do that or

stray garnet
#

hmm

#

ill try it

knotty steeple
#

also you can do member.guild to get info about what guild the member joined

#

and that that point you can find a channel

#

to post your welcome message

#

@stray garnet

earnest phoenix
#

No

stray garnet
#

uh oops

#
  let guild = member.guild
  const embed = new Discord.RichEmbed()
  .setDescription(`Welcome`)
  guild.channels.find(`name`,`welcome`).send(embed)
})
knotty steeple
#

no

stray garnet
#

k

earnest phoenix
#

guild.channels.find??

knotty steeple
#

as i said

#

it only takes 1 param

#

which is member

earnest phoenix
#

Find function doesn't work like that

knotty steeple
#

it does but its depreciated

#

so you shouldnt use it like that

stray garnet
#

how then

knotty steeple
#

you dont even need message

#

remove that

earnest phoenix
#

.find(c => c.name === 'name')

knotty steeple
#

@earnest phoenix let guild = member.guild

#

btw

earnest phoenix
#

ah ye

knotty steeple
#

so its basically member.guild.channels.find

stray garnet
#

so the same?

knotty steeple
#

just remove message

#

from (message, member)

#

member => { works also

earnest phoenix
knotty steeple
#

and it should work

livid rivet
#

hey guys

#

oh shit i lost my green role

#

anyways

#

I have a question regarding role management in discord.py

west spoke
#

what version

livid rivet
#

newest

west spoke
#

k then I'm out lol

livid rivet
#

I want to save every role in a json file and with them the permission value

west spoke
#

it already has all that on the api endpoints

livid rivet
#

well it says python AttributeError: 'Role' object has no attribute 'value'

#

wait

#

you can?

#

oh hekk

west spoke
#

Yep

livid rivet
#

i have never considered that ๐Ÿคฆ

west spoke
#

/server/roles/roleid

#

it returns json with role data

#

ID, name, permissions, etc

livid rivet
#

roleid? isnt that just the id? or am I wrong?

west spoke
#

The role's snowflake

#

<@&364144633451773953>

#

trial mod role

fossil oxide
#

That pinged me...

livid rivet
#

and the ID contains all the permissions?

fossil oxide
#

Who the fuck gave me the trial mod role

#

Actually getting demoted

west spoke
#

Did it actually

#

hiw

#

@west spoke

#

that doesnt ping me wtf

livid rivet
#

the & is missing

fossil oxide
west spoke
#

BRUH WHAAAAT

#

Since when

loud salmon
#

Note to self, when you need oliy to respond to something, give him the trial mod role and pongerino that

west spoke
#

Since when?!

stray garnet
#

LOL

#

<@&523885075776143360>

quartz kindle
#

What does the & do?

stray garnet
#

What tf

#

my id is an role lmfao

quartz kindle
#

Oh its role ping

#

Am dum

stray garnet
#

<@&523885075776143360>

#

HUH

#

MY ID IS AN ROLE?

wide ruin
#

when the bot sends a message, how do you check for a response for the next 30 seconds?

west spoke
#

it's in the lob

#

Lib

unique nimbus
#

What's a good database which I can use which is fairly easy to learn

quartz kindle
#

Sqlite

earnest phoenix
#

LazyNeko user mentions use @ ! <snowflake>

manic blade
#

Where can i host my .net discord bot for free?

unique nimbus
#

I don't think you can

mossy vine
#

for free? likely nowhere

manic blade
#

Rip

mossy vine
#

maybe heroku supports .net but im not sure

manic blade
#

It doesnt

#

I have to use build packs that don't work very good

mossy vine
#

then probably nothing free

#

unless you use free/trial plans from providers

manic blade
#

I can't do that because of my location

copper cradle
#

lol

#

use a windows server

eager plaza
#

-help

unique nimbus
#

no

eager plaza
#

@gilded plank

unique nimbus
#

what are you trying to do

eager plaza
#

i don't really now

#

know *

unique nimbus
#

ok

eager plaza
#

i think to i want make a bot so i don't know how , i know coder

mossy vine
#

do you know any programming languages

unique nimbus
#

How old are you btw?

#

we got supporters depending on age

eager plaza
#

Yes

#

Lua

#

im 13 years old

unique nimbus
#

okay dokie

eager plaza
#

but i don't know the languages of bot

unique nimbus
eager plaza
#

ok thank u

wide ruin
#
            let mssg = await message.channel.send(`Step 1:\nType the word \`${word}\` below.`)
            let filter = (user, channel) => user.id === message.author.id && channel.id === message.author.channel.id;
            let collector = new Discord.MessageCollector(message.channel, filter, 1, 1);
            await message.channel.send(collector.collected[0])```
#

js

#

i need it to send back what the user says,

#

currently says: DiscordAPIError: Cannot send an empty message

#

so im guessing i need to wait until the user actually sends a message

#

how would i do that?

copper cradle
#

collector.once("collect", collected => {})

#

idr if it was on or once

#

then you can do

#

collector.on('end', collected => {})

#

but I'm not sure

earnest phoenix
#

Help someone

#

Why I use command and he spam?

#

because you aren't encasing your code block that's supposed to go under the if condition

#
if(condition)
    line of code
rest of the code

is not the same as

if(condition) 
{
    code
}
hushed berry
#

dang, code blocks are so much more readable now

grim aspen
#

there should be a { after the if statement and a } under the message send

#

another thing is that's glitch

stuck quartz
#

Shouldn't the two var lines end with semicolons?

#

Joining late and not sure of the language, but I see a semicolon at the end.

mossy vine
#

no

grim aspen
#

now i can't unsee that

stuck quartz
#

lol right

mossy vine
#

putting a semicolon after RichEmbed() would cause the next line to not chain onto it

stuck quartz
#

No, not that line.

mossy vine
#

(and javascript has asi or whatever its called anyways)

grim aspen
mossy vine
#

what about that

stuck quartz
#

inconsistent

#

I'm not a js dev, but I'd never use ASI intentionally.

mossy vine
#

i kinda love it

earnest phoenix
#

because that's not a valid path

#

So my bot has been unable to login today. i went to check stuff and eventually figured out it was rejecting the token (oddly it doesnt give any error for that, just say that the shard takes too long to become ready) so i go to developer menu on discordapp.com and recopy my token, and i just noticed that every time i refresh the page, the token is different. why is my token getting regenerated?

unique nimbus
#

Discord%20Bot

fallow quiver
#

Itโ€™s the exact path

unique nimbus
#

If I remember thats what space is

earnest phoenix
#

that's html encoding

unique nimbus
#

oh

fallow quiver
#

I copied it and tried it 50 different ways

earnest phoenix
#

it's not a valid path

#

use quotes

#

no

#

well

#

yeah nevermind

#

i got used to unix file system and forgot how it works for a second

molten yarrow
#

Hello, is there a easy way to get all user ids that reacted to a message from Bot? im using ReactionCollector with time filter but it want work :O
im using js ๐Ÿ™‚

earnest phoenix
#

MovementToday at 9:27 PM
So my bot has been unable to login today. i went to check stuff and eventually figured out it was rejecting the token (oddly it doesnt give any error for that, just say that the shard takes too long to become ready) so i go to developer menu on discordapp.com and recopy my token, and i just noticed that every time i refresh the page, the token is different. why is my token getting regenerated?
tag: TL;DR: Calm down. Your bot tokens still work.

Discord doesn't store tokens. Instead, it create tokens by cryptographically signing a user ID and timestamp. Each time you refresh the page, the current time changes, and you get a new token. However, all the tokens you see are still valid until you click Generate a new token?

fallow quiver
#

So itโ€™s should be

cdโ€Users\Onedrive\Documents\DiscordBitโ€
earnest phoenix
#

those are apple quotes, but yes

fallow quiver
#

Ok thanks

earnest phoenix
#

you're also missing a starting backslash

fallow quiver
#

Oops

potent wagon
#

Also you forgot to do like C:

earnest phoenix
#

you don't need to define the drive

fallow quiver
#

Thatโ€™s there by default

potent wagon
#

Yes?

earnest phoenix
#

you don't

#

your bot tokens still work
hmmm great now i have no idea whats going on then back to the drawing board

#

lol

#

ok so found an error message finally, it says "invalid token". i print the token out and its being read correctly from config, and i try regenerating and putting new in, nothing work

#

are you sure it's the token and not the secret

#

the only other thing that comes to mind is that you rapidly logged in and logged out

#

so discord changed your token, check your email for that

#

got no email

#

im sure its the token not client secret

#

does it work if you try to log in with another bot app

#

trying that now

#

which discord.js version are you using

#

12.0.0 (its a fork of official where i changed one line in sharding to let me capture pipes. as the test program doesnt use sharding, that rules out that change from breaking stuff)

amber fractal
#

update

#

there's errors with master logging in

#

npm i discordjs/discord.js

#

or

earnest phoenix
#

its worked for over a month tho?

amber fractal
#

yes

earnest phoenix
#

any simple way to update my fork without having to redo my change? (i normally dont do much with git)

amber fractal
#

Api changes

#

api changes

#

wtf

#

double post

earnest phoenix
#

rip xd

amber fractal
#

uh you can add the code yourself ig?

earnest phoenix
#

you mean the commits that my fork is behind?

amber fractal
#

one sec

#

wait when did it stop working

#

like when's the last time it was on

earnest phoenix
#

i noticed it was offline this morning when i went to work on new features. i last used it on sunday.

#

i did not make any changes to my discord.js fork (havent since the day i made it)

amber fractal
#

hm

#

the error was a while ago

earnest phoenix
#

ima go delete and recreate my fork just to do something

#

cant rly hurt

#

still "an invalid token was provided"

#

pure fork of discord.js with no modifications

amber fractal
#

hm

earnest phoenix
#

AHA explicitely installed stable branch and test program works now

amber fractal
#

well that's why it's stable

earnest phoenix
#

indeed

fallow quiver
earnest phoenix
#

you need a space between the command and the arguments

fallow quiver
#

So a space after cd

earnest phoenix
#

yes

fresh kernel
#

Overnight my discord bot has gone from working fine to the music being broken.
When issuing the play command, the bot does manage to get the video data but after connecting to the voice channel it simply disconnects and outputs "undefined" in dark gray. I've tried reinstalling node-opus, prism-media, going back to previous versions and I'm lost at this point.
I know about the deprecation warning, but thats been there for ages.

The line that calls ytdl-core is as follows:

const dispatcher = serverQueue.connection.playStream(ytdl(song.url))

Using;
Node.js 11.15.0
discord.js 11.5.1
node-opus 0.3.2
prism-media 1.1.0
ytdl-core 0.29.6

grim aspen
#

it's an issue on ytdl's side

fresh kernel
#

How would that just break overnight though? I haven't even restarted the application

grim aspen
#

like i said

earnest phoenix
#

yeah youtube was a b**** and made it impossible to download songs

fresh kernel
#

Oh.

grim aspen
#

it's on ytdl's side

earnest phoenix
#

literallly every bot that pull from utube is broken rn

fallow quiver
#

I still cannot get the path to work, I have to be missing something

fresh kernel
#

Well damn. Thanks for clarifying

fallow quiver
#

Should I try moving the file to a different place?

earnest phoenix
#

the directory you searched for simply doesn't exist

fallow quiver
#

I copied and pasted

#

Leaving out C:\Users\ezj21 of course bc thats already there

cobalt kestrel
#

Hello is there a support channel?

earnest phoenix
#

you can't leave out \Users\username

#

you can leave out the drive only

fallow quiver
#

Ok

loud salmon
#

@cobalt kestrel support for bot development goes here

cobalt kestrel
#

I was just wanting to ask if there is a way to bump servers up the list?

loud salmon
#

nope

#

no way to do so

cobalt kestrel
#

ok thanks. I am still going to use the site because its advertisement at the end of the day ๐Ÿ˜„

loud salmon
#

kk

fallow quiver
#

I did it and I feel stupid

#

I had re-written it to leave out the drive and I changed OneDrive to OneNote for some reason

split hazel
#

SQLite3
So i made 2 tables, both have the same column name. I inserted values into the column for each of the 2 tables, then ran SELECT * FROM table1, table2 but i only got data from one of the tables, not both.

quartz kindle
#

to select from multiple tables, you need to use JOIN

#

google sql joins

earnest phoenix
#
let money = db.fetchAll(`money_${message.guild.id}`, { sort: '.data'})
console.log(money)
    let lol = "";

    for (let i = 0; i < money.length; i++) {
        let user = client.users.get(money[i].ID.split('_')[2]).username

        lol += `${i+1}. ${user} ~ ${money[i].data}$\n`
    }

    const embed = new Discord.RichEmbed()
    .setAuthor(`${message.guild.name} - Leaderboard`, message.guild.iconURL)
    .setDescription(lol)

    message.channel.send(embed)
#

(node:4362) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'username' of undefined

#

tried to log money

#
[ { ID: 'money_400845681574674442', data: 315 },

  { ID: 'daily_400845681574674442', data: '1568259097556' },

  { ID: 'money_401360645720899584', data: 102 },

  { ID: 'daily_401360645720899584', data: 1567679601757 },

  { ID: 'money_601331300925702144', data: { sort: '.data' } } ]```
#

idk how to log user the err prevented it from showing + idk how to eval it

#

im using v7

#

update: i tried to edit (money.[i].ID.split('_')[2]).username to (money.[i].ID.split('_')[1]).username same thing

sick cloud
valid frigate
#

put a horizontal line beneath the first title

#

maybe will help it stand out

#

otherwise you're onto something

copper cradle
#

or use a separate field

valid frigate
#

oh yeah and footer text can display how many pages in the queue, total queue length, etc

copper cradle
#

yes

valid frigate
#

inline fields are very subjective

#

depending on if youre going for readability or prettiness

#

also maybe video duration if you are up for that

#

it might cause the text to wrap around making it U G L Y but your call

sick cloud
#

okay

warm marsh
#

@earnest phoenix did you fix it?

earnest phoenix
#

ye i did

#

ty for asking

earnest phoenix
#

Ugh nope

#
const economy = new db.table('money')

let money = economy.fetchAll(`money_${message.guild.id}`, { sort: '.data'})
    let lol = "";

    for (let i = 0; i < money.length; i++) {
      money.length = "10";
      
        let user = client.users.get(money[i].ID.split('_')[1])
if (!user) console.log("lol");
        lol += `${i+1}. ${user} - **${money[i].data}$**\n`
    }

    const embed = new Discord.RichEmbed()
    .setTitle(`**${message.guild.name} - Leaderboard**`)
    .setDescription(lol)

    message.channel.send(embed)
  

#

Cannot read property 'ID' of undefined

#

it was literally working hours ago

twilit rapids
#

Is the ID undefined for the guild

#

Then it could be that the command has been run from a DM

earnest phoenix
#

No?

quartz kindle
#

money.length = 10

#

this will truncate the array

#

if the array is bigger than 10, then you will start looping into non-existent items

#

move that line to before the loop

earnest phoenix
#

and then?

quartz kindle
#

and then what?

#

try it

earnest phoenix
#

Nope same thing

quartz kindle
#

then log money

earnest phoenix
#

Is this where im supposed to put it?
const economy = new db.table('money')

let money = economy.fetchAll(money_${message.guild.id}, { sort: '.data'})
console.log(money)
let lol = "";
money.length = 10
for (let i = 0; i < money.length; i++) {

let user = client.users.get(money[i].ID.split('_')[1])
if (!user) return console.log(money[i]);

    lol += `${i+1}. ${user} - **${money[i].data}$**\n`
}
quartz kindle
#

yes

earnest phoenix
#

[ { ID: 'money_400845681574674442', data: 563 },
4:47 PM
{ ID: 'money_401360645720899584', data: 7 } ]
4:47 PM

quartz kindle
#

so your problem is that you're making the length 10, when its actually smaller, not bigger

#

so it fills up with empty items until it gets 10

#

just make an if

#

if(money.length > 10) money.length = 10

earnest phoenix
#

Ok ty! It worked ๐Ÿ‘

summer torrent
#

it is possible to add video to embed ? (discord.js)

earnest phoenix
#

Ok, i have another problem

#

The lb is out of order

#
const economy = new db.table('money')

let money = economy.fetchAll(`money_${message.guild.id}`, { sort: '.data'})
console.log(money)
    let lol = "";
if(money.length > 10) money.length = 10
    for (let i = 0; i < money.length; i++) {
      
      
      
 let user = client.users.get(money[i].ID.split('_')[1])
if (!user) return console.log(money[i]);

        lol += `${i+1}. ${user} - **${money[i].data}$**\n`
    }
quartz kindle
#

fetchAll doesnt accept any options, everything inside the () is ignored

#

it just dumps the entire database

warm marsh
#

Just filter the returned data.

earnest phoenix
#

then what function do i use in v7

warm marsh
#

v7 of what?

earnest phoenix
#

quick.db

warm marsh
#

fetchAll()

#

just filter the data.

earnest phoenix
#

how?

warm marsh
#

What do you get when console.log money?

earnest phoenix
#

[ { ID: 'money_400845681574674442', data: 607 },

{ ID: 'money_401360645720899584', data: 7 },

{ ID: 'money_507580053501247489', data: 24 },

{ ID: 'money_568356933967544330', data: 184 } ]

warm marsh
#

Ok.

#
const money = await economy.fetchAll().filter(entry => entry.ID == `money_${guild.id}`);```
#

Something like that but you will have to test.

#

And that will most likely not work it's just an example.

quartz kindle
#

using startsWith is probably more efficient

#

unless your entire table only has money rows

#

quick.db docs are all over the place, many things are not even documented

earnest phoenix
#

ik, people say v7 has startsWith but then when i use it, it says it's not a function

quartz kindle
#

what a joke of a db lul

#

according to the docs in their official website, you should use db.all()

#

not even fetchAll lol

#

anyway, if you're using all or fetchAll, if your table only contains money entries, use .sort(), if it contains other types of entries, use .filter().sort()

earnest phoenix
#

Discord.js v12, how we do it. so that when a user boosts a server, the bot sends him a private message?

amber fractal
#

Not sure if there is a boost event yet

#

I havent checked the docs tho

mossy vine
#

its a message type isnt it

zealous veldt
#

Yeah it would be one of the server messages or whatever they're called

amber fractal
#

System message

#

But you can turn it off

#

message.system

#

True or false if it's a system message

#

Then you can check if the content includes boost mmulu

wide ruin
#

js, how do you wait until a user sends a message?

#

i currently need to run a block of code, wait until you get a response, run another bit, get a response and send something

#

but it just runs the first block, and second, and output

quartz kindle
#

channel.awaitMessages()

wide ruin
#

ok thanks

#

i did message.channel.awaitMessages(m => m.author.id = message.author.id) but it just ignored it

#

@quartz kindle

quartz kindle
#

its a promise

#

did you await it?

wide ruin
#

no

quartz kindle
#

duh

wide ruin
#

ive literally never seen the function before

quartz kindle
wide ruin
#

also did i do the filter wrong?

#

it doesnt continue

mossy vine
#
// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
  .then(collected => console.log(collected.size))
  .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));```
quartz kindle
#

@wide ruin you did = instead of ===

wide ruin
#

is that right then?

mossy vine
#

should be

valid frigate
#

tryna have my bot react using message.react but its being stingy rn

#

what should i use for the emoji string? i'm trying to use ๐Ÿ—‘๏ธ but it rejects it as unknown emoji

#

djs master

smoky spire
#

Use unicode

valid frigate
#

that's what i'm using

#

believe its because the wastebasket emoji actually has 2 characters

#

i used the x emoji and it worked fine

daring trellis
#

Hi, please tell me how to add new rights to an existing role?

keen karma
#

Discord help me now!

mossy vine
#

what

west spoke
#

@keen karma what with

mossy vine
#

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

ok but just pressing enter throws that error wtf

#

running it with sudo worked :(

knotty steeple
#

cyber lmao

mossy vine
#

how was i supposed to know

modern sable
#

same

#

i ran into that issue aswell

#

pretty sure it's because mariadb wants the login request to come from the root acc

#

or at least thats what i heard

glad shell
#

anyone else ran into an issue with the Discord iOS app double encoding spaces in URLs?

#

doesn't happen on desktop or android, but any links my bot sends, iOS discord encodes %20 to %2520

slim heart
#

how would one host a completely separate process to do one thing, and other processes can like send it its params and it'd lighten the load onto that process but also keep it only running once for many of them
Im sure theres a way to use ipc on it but it doesnt seem optimal since it doesnt have a direct way of calling back rather than sending an event to all processes for that one processes result.

amber fractal
#

you mean like an internal api?

rough plaza
#

Cool

opaque eagle
#

that's what lambda functions are for

#

aws lambda / google cloud function / zeit lambdas

peak quail
#

How can i see how many Guilds are in a shard
๐Ÿค”

floral bloom
#

Discord.js
How would I remove all reactions from a message?

#

Ping with response, please.

amber fractal
#

I'm gonna assume you're on stable and that you already checked the docs like a good developer, so I'm just going to give you the docs https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=clearReactions

#

@floral bloom

floral bloom
#

I checked the docs, but didn't see that. Thanks.

knotty steeple
#

ok uh

#

how do you use eris collections

amber fractal
short ocean
#

How would i do an uptime command for discord js

dusky marsh
#

client.uptime gets you the uptime in ms

amber fractal
#

you cant be this basic

dusky marsh
#

then just format it, its very easy

#

@short ocean

short ocean
#

Aah ok

#

Im stupid

#

Wait

#

Im using glitch

#

And that doesnt work

#

For me

#

Ok nvm

#

I got it

#

@dusky marsh how would i convert it into minutes

#

im stupid

dusky marsh
short ocean
#

Yea but i mean in the code..

#

Using math.round or something

dusky marsh
#

dude, i meant google it yourself instead of pinging me ๐Ÿคฆ

earnest phoenix
#

how much is discord nitro boost

short ocean
#

$10

earnest phoenix
#

Ok

short ocean
#

but thats off topic question

amber fractal
#

@short ocean do you know how milliseconds work?

hoary helm
#

divide the time value by 60000

#

oops I'm three hours late

stray garnet
#

@short ocean uhm u know, i can give u mine...

short ocean
#

Oo

#

@stray garnet

#

Ok

slender thistle
#

No spoonfeeding please

stray garnet
#

@slender thistle kk

heavy phoenix
#

yes

snow urchin
#
(async() => {
let db = require('quick.db')
let items =await  db.fetch('users.test');
let index = items.indexOf(message.author.id);
let newSet =  items.splice(index, 1);
 db.set("users.test", newSet)
})()

Why is this not removing my user id from the array?

slim heart
#

Splice return the values it removed, redefining the original array

sage bobcat
#

One message removed from a suspended account.

snow urchin
#

oh?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

snow urchin
#

adding a space will really make no difference

slim heart
#

Yeah

#

Anyways youโ€™d want to splice it and then use the original array to post, because when you do .splice it redefines the original one, it doesnโ€™t return the new value

sage bobcat
#

One message removed from a suspended account.

snow urchin
#
(async() => {
let db = require('quick.db')
let items =await  db.fetch('users.test');
let index = items.indexOf(message.author.id);
let newSet =  items.splice(index, 1);
 db.set("users.test", items)
})()

this?

slim heart
snow urchin
#

Alright, thanks for your help!

eager perch
#
const discordbotsorg = new DISCORDBOTSORG(config.discordbotsorg, bot);
#

This ain't sending my stats over?

west raptor
wheat jolt
#
await msg.guild.members.find(m => m.nickname.toLowerCase() == newNickname.toLowerCase())
#

discord.js lib

#

why it's throwing me: toLowerCase is not a function

twilit rapids
#

Then that member hasn't set a nickname

wheat jolt
#

hold on

twilit rapids
#

member.nickname returns null if a member hasn't set a nickname

#

So you could search for username

earnest phoenix
#
module.exports.run = async (client, message, args) => {
const economy = new db.table('money')
let money = await economy.startsWith(`money`, { sort: '.data'})
    let lol = "";
if(money.length > 10) money.length = 10
    for (let i = 0; i < money.length; i++) {
      
      
      
 let user = client.users.get(money[i].ID.split('_')[1])
if (!user) return console.log(money[i]);

        lol += `${i+1}. ${user} - **${money[i].data}$**\n`
    }

    const embed = new Discord.RichEmbed()
    .setTitle(`**Global Leaderboard**`)
    .setDescription(lol)

    message.channel.send(embed)


}```
#

it doesn't send anything

#

gives me this in log

{ ID: 'money_467569016924274709', data: 24 }```
warm marsh
#

after ```js
if (!user) return console.log(money[i]);

#

on the next line add ```js
console.log("Passed");

#

or something to see if it isn't returning there.

#

Although, That shouldn't even be the problem. Maybe lol.length is too long?

quartz kindle
#

user might not be cached

earnest phoenix
#

it gaved me "passed" 4 times

#

maybe there were 4 users that were cached

quartz kindle
#

if one user is not cached, it returns and exits the function, so it never sends

warm marsh
#

You could change the return to a continue

#

meaning it will skip that user.

#

Or get the user the other way.

#

master: client.users.fetch(id); I think.

earnest phoenix
#

hm

#

ok ty! it worked ๐Ÿ‘

snow urchin
loud salmon
#

Get message that was chosen either in the command arguments or in a different process -> get list of reactions -> find specific emoji -> get list of people that reacted -> get random index of the list -> you found your winner @snow urchin

snow urchin
#

Anytime I do this, it just returns undefined:

message.channel.fetchMessage("message id").then(msg => {
msg.reactions
})
loud salmon
#

what do the docs say?

slim heart
#

And wdym it returns undefined, log it

grim aspen
#

maybe it's because msg.reactions has no action, so the bot does nothing with that code

#

whelp maybe except storing it

#

it will only collect it, but after collecting, based on the code you sent, it will do nothing after msg.reactions

wooden mango
#

How to upload own bot

#

i have typed above 300 characters but still saying this only

grim aspen
#

300 characters is 300 words

wooden mango
#

ik @grim aspen

grim aspen
#

@slim heart not helping

wooden mango
#

I have typed 300 words

slim heart
#

Thatโ€™s why I deleted it thanks

manic blade
#

Does anybody here know how to host a c# (.net) bot 24/7 for free?is there a way?

grim aspen
#

vps

wooden mango
#

what is vps?

slim heart
#

No there isnโ€™t @manic blade unless you run it on your computer thatโ€™s on 24/7

#

Or like an old laptop, some people even use their android phones

wooden mango
ebon tiger
#

PLEASE HELP ME

mossy vine
#

posting your issue would be nice

ebon tiger
#

how can i add bot to official discord bot list

mossy vine
ebon tiger
#

yes it dosent work

mossy vine
#

cool

#

are you gonna.. explain how it doesnt work?

slim heart
#

Define โ€œdoesnโ€™t workโ€

ebon tiger
modern elm
#

how do i check for a specific error code

slim heart
#

@modern elm error.code it usually is

modern elm
#

ok thx

mossy vine
#

@ebon tiger can you read

ebon tiger
#

yes but dont know what to do now

modern elm
#

lmfao

mossy vine
#

bye

slim heart
#

Well add some more things to get 300 characters

#

And not random bs either like actual stuff

ebon tiger
#

i made this bot on discord bot maker apk

slim heart
#

That has nothing to do with this

modern elm
#

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

ebon tiger
modern elm
#

oml

#

pls read

ebon tiger
#

where i can read ?

modern elm
#

try there

ebon tiger
#

i said i dont know what to fill in this

quartz kindle
#

you dont know what "detailed description of your bot" means?

ebon tiger
#

yes i dont know

modern elm
#

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

#

describe your bot

quartz kindle
#

do you know what the word "description" means?

modern elm
#

in detail

quartz kindle
#

to describe something = to talk about something and explain about something

#

detailed = with a lot of information

loud salmon
#

@ebon tiger we dont allow bots on our site that are made on a phone

ebon tiger
#

why

quartz kindle
#

lol rly

loud salmon
#

@quartz kindle because no code mmulu

quartz kindle
#

wait is dbm also banned?

ebon tiger
#

then what i am saying

mossy vine
#

dbm is allowed

loud salmon
#

@ebon tiger because we want our bots to actually be coded, not just made in a template

mossy vine
#

cuz its not just templating

loud salmon
#

@quartz kindle it allows people to do more than just template bots like botghost and dbd

quartz kindle
#

well he said hes using dbm apk, is it different from dbm desktop?

mossy vine
#

yeah, its a completely different thing

quartz kindle
#

ah ok

ebon tiger
hollow prawn
#

quickly need help, for channel overwrites how many overwrites can I set up ๐Ÿค”

#

e.g. can I have permissionOverwrites for one thing and permissionOverwrites for another role or user (library is discord.js)

hollow prawn
#

nvm resolved

earnest phoenix
#

so basicially

#

i try to make a message collector

#

and on collect it should add a previous made role

#

but if i run it to add the role

#

which confuses me

#

just

#

a little big

amber fractal
#

Here

#

Do this in console

earnest phoenix
#

author != member

#

How can i get the member from him?

amber fractal
#

Oh I didnt even see that

earnest phoenix
#

read the docs

#

It says literally

#

nothing about this

twilit rapids
#

Author returns the user object, you need the member object to add a role.

amber fractal
#

It does

earnest phoenix
#

the docs have everything you need

amber fractal
#

message object

earnest phoenix
#

learn to use them

amber fractal
#

Properties

earnest phoenix
#

@twilit rapids hoW can i get the member obj from him then?

amber fractal
#

Docs

twilit rapids
#

You can use message.member instead of message.author.

earnest phoenix
#

thaNK

amber fractal
#

(Which is in the docs)

earnest phoenix
#

man i love it when people are willing to cry, pout and beg for an answer for 5 minutes instead of reading the docs which would've taken a minute or less

opaque eagle
#

I wish YouTube bot tutorials put more emphasis on how to read docs

mossy vine
#

ive yet to see one that mentions docs

unique nimbus
#

I wish YouTube tutorials dont give the code in description

opaque eagle
#

Ik one

#

But only one

quartz kindle
#

if youtube tutorials were actually good at teaching, teachers would not have jobs

unique nimbus
#

yes

amber fractal
#

But my teachers show youtube videos

west spoke
#

YouTube autoplay

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

low wasp
#

@sage bobcat

.send('message', {split: true})```
#

easiest

#

but can spam channel

earnest phoenix
#

that's splitting by length

#

aka every 2k characters

low wasp
#

yeah

earnest phoenix
#

not every y occurance in x

low wasp
amber fractal
#

ew

#

modules

#

disgusting

topaz fjord
#

ew pagination

amber fractal
#

pagination is better than cluttering a channel

unique nimbus
#

true

earnest phoenix
#

yes

#

the problem comes in when it's overused for everything

amber granite
#

^learned this the hard way lol

amber fractal
#

My pagination is 9 lines long mmLol

earnest phoenix
#

pagination is supposed to be used to show large amounts of content in a small message, a lot of people use it for other things too which becomes really bad UX

amber fractal
#

oh

#

I use it in like search results

earnest phoenix
#

yeah that's fine

amber fractal
#

where it returns hundreds of results

amber granite
#

Its nice for stuff like help command too, if you want to display by module

lofty hamlet
#

Hi

#

I can edit embed image ?

earnest phoenix
#

yes

lofty hamlet
#

How ?

quartz kindle
#

message.edit(newEmbedWithNewImage)

lofty hamlet
#

No embed

#

Edit the .setimage of embed

west spoke
#

use another embed

wooden lance
#

Im using sqlite3 (discord.js) and was wondering if anyone knows how to make it so if a response is "true" continue the code, and if it is something else, don't.

west spoke
warm marsh
#

if statement?

wooden lance
#

?

warm marsh
#

if (variable) {} else return

wooden lance
#

Ok

#

Thanks

small latch
#

Braindead.

lofty hamlet
#

@west spoke no i want edit embed

#

@quartz kindle you have the answer ? ๐Ÿค”

west spoke
#

You literally have to define a seperate embed. End of story @lofty hamlet

amber fractal
#

he wants to edit the message

earnest phoenix
#

there's no way to directly edit the embed, you need to replace it as a whole

west spoke
#

^

amber fractal
#

use this

#

get data

west spoke
#

I for once agree with @earnest phoenix

amber fractal
#

add to it

#

you can literally new Discord.RichEmbed(<MessageEmbed>) I believe

#

then treat it like any other embed you're coding

#

It's a little different on master

#

I assume you're on stable though

west spoke
#

who said they were using javascript

#

d.py async has <embed>.setimage(url)

#

likely same case for rewrite

amber fractal
#

Because I've helped him before...

west spoke
#

fair enough

amber fractal
#

He could've moved to another lang

west spoke
#

I'm meaning right now thommulu

amber fractal
#

but I'm using past knowledge

modest sigil
#

does any one know how to use youtube_dl search function properly please send me a code snippet example

warm marsh
#

youtube-dl?

amber fractal
#

ytdl

west spoke
#

@modest sigil spoonfeed

#

we wont give you a example. You have to make it yourself

warm marsh
amber fractal
west spoke
#

@amber fractal ytdl fixed it after like 10min

earnest phoenix
#

they could be using ytdl alone without packages

amber fractal
#

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

earnest phoenix
#

let them breathe lol

west spoke
#

^

small latch
#

@earnest phoenix They have lungs for a reason.

warm marsh
#

node-opus, ytdl-core, ffmpeg are required to make a music bot.

west spoke
#

ok this isnt the channel for joking around

earnest phoenix
#

Turbulent.Today at 11:10 PM
node-opus, ytdl-core, ffmpeg are required to make a music bot.
this is false

west spoke
#

^

earnest phoenix
#

that's a standard for node.js bots

west spoke
#

you just need a mp3 and ffmpeg I believe

warm marsh
#

required to make a music bot in node*

earnest phoenix
#

you can make a music bot with anything that encodes audio into opus bytes and that converts non standard audio to PCM

warm marsh
#

That better?

inner jewel
#

andesite/lavalink mmLol

amber fractal
#

still wrong

west spoke
#

@small latch NO

#

DELETEE

amber fractal
#

@small latch leave if you arent helpful

west spoke
#

REEEEEE

#

^^

modest sigil
#

@west spoke it is giving me an Exception of command Invoke

west spoke
#

wat

#

ok I mean

warm marsh
#

l2c

#

?

west spoke
#

You haven't sent any code

#

@small latch delete it.

modest sigil
#

wait i will send u a code

west spoke
#

send here

warm marsh
#

Use hastebin or pastebin, code blocks in discord are meh.

west spoke
#

^

quartz kindle
#

having to open a new tab annoys the shit out of me

#

because i usually have 50+ tabs open

amber fractal
#

why

warm marsh
#

Fair.

west spoke
#

@quartz kindle i mean chrome on phone is optimized a loooot so I have like 100 idle tabs

#

Since it opens new ones for discord

quartz kindle
#

by "optimized" you mean, it saves the link, then refreshes the page every time you open said tab

#

lul

earnest phoenix
#

hey i had a question

#

so im adding a feature which adds a user a role when they send the bot a dm

#

but I don't know how to specify a guild for .guild

manic blade
#

@slim heart ok tnx for replying i didnt see that

earnest phoenix
#

I know what it is im just having a massive brain fart

#

it doesn't exist, you need to get it from your client

#

im hoping to define it by id

west spoke
#

@earnest phoenix they need to define server ID/get servers that the user is in

#

and that the bot is in as well

earnest phoenix
#

how do i define the guild by id

#

yea

#

in which lib

#

d.js?

#

d js

quartz kindle
#

either the user needs to supply the guild in the dm

earnest phoenix
#

no its the same guild no matter what

quartz kindle
#

or you need to save the guild information if the user talks to your bot before moving to dms

earnest phoenix
#

its a private bot

#

this is the code at the moment

quartz kindle
#

then just get the guild by id

quartz kindle
#

client.guilds.get(id)

earnest phoenix
#

that

#
  if(message.author.bot) return;
   if (message.channel.type == 'dm')
  let guild = 622175430501335050
  let role = message.guild.roles.find(r => r.name == 'Currently Being Helped');
  message.guild.members.find(m => m.id == message.author.id).addRole(role);```
#

this is the code at the moment

small latch
#

@west spoke I don't help brain non-existent people.

earnest phoenix
#

wait me?

#

lol

amber fractal
#

@modern sable can you brighten this guy's mood pls

small latch
#

Of course, who else Messi.

earnest phoenix
#

wow

quartz kindle
#

@earnest phoenix look at my last message

manic blade
#

Are you serious?

earnest phoenix
#

i know i fixed it

quartz kindle
#

๐Ÿ‘

earnest phoenix
#

thanks for the help

#

๐Ÿ™‚

small latch
#

@manic blade Possible.

#

^ Salt?

manic blade
#

Hellyea

small latch
#

As an emoji.

#

Im a barbie girl, in a barbie world!

west spoke
#

....

small latch
#

Make me walk, make me talk do whatever you please.

west spoke
#

@small latch stop

unique nimbus
#

Can you not

amber fractal
#

marco pls

modern sable
#

@small latch can you stop insulting people and take this chat seriously

amber fractal
#

he's so goddamn annoying

west spoke
#

this is for development only

modern sable
west spoke
#

tbh just mute him for 69h

small latch
#

Do you use macros @modern sable

manic blade
#

Cmon dude

modern sable
manic blade
#

You 're not even funny anymore

small latch
#

@manic blade Want to brush my hair?

quartz kindle
#

thank you

west spoke
#

worth it

#

69h pls

manic blade
#

wow

west spoke
#

Good enuff marco

#

Anyways what's the endpoint for user roles

#

or better yet, server roles

#

Aaaads

warm marsh
#

Ban

west spoke
#

@modern sable have fun

earnest phoenix
#

Is that not allowed?

warm marsh
#

ะฝะตั‚

modern sable
#

not really

#

falls under rule 4c

earnest phoenix
#

Ah, sorry

#

Wasn't sure if this also counted as "begging people to use my bot"

manic blade
#

Is there a way to check if someone is invisible with a .net bot?

manic blade
#

Discord makes the invisible(5) offline(0)

west spoke
#

api calls

wooden lance
#

Having some issues, anyone know how I can fix this code? (discord.js)

  const guildConf = client.settings.ensure(message.guild.id, defaultSettings);

TypeError: Cannot read property 'id' of null
    at Client.client.on.message (/root/DiscordBotApp/bot.js:107:58)
    at Client.emit (events.js:203:15)
    at MessageCreateHandler.handle (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (/root/DiscordBotApp/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
    at WebSocket.onMessage (/root/DiscordBotApp/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (/root/DiscordBotApp/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:198:13)```
```javascript
client.on("message", message => {
  client.settings = new Enmap({
    name: "settings",
    fetchAll: false,
    autoFetch: true,
    cloneLevel: 'deep'
  });
  const guildConf = client.settings.ensure(message.guild.id, defaultSettings);

  if (guildConf.inviteblock) return; {
    const inviteLinks = [`liam:invitelinktest`]
    try {
        if (inviteLinks.some(word => message.content.toLowerCase().includes(word))) {
            message.delete();
        
              let warnConfirm = new Discord.RichEmbed()
              .setTitle(`Punishment Successful`)
              .setDescription(`${message.author} was warned for sending invite links`)
              .setColor(`#006aff`)
              .setFooter(`By [AUTOMOD]`)
              message.channel.send(warnConfirm);
}
}
});
idle basalt
#

message.guild is undefined

#

this means youre getting a dm

manic blade
#

I want it for .net btw

idle basalt
#

make sure that these messages occur only in a guild

#

if (!message.guild) return; at the top will stop dms

wooden lance
#

It wasnt a dm