#development

1 messages Β· Page 1690 of 1

quartz kindle
#

just google "x game in y gpu" and see what the average frame rate is and what settings does it run on

opal plank
#

@sacred juniper

#

you welcome

#

next customer pls!

sacred juniper
#

I playde satisfactory wiith 1gb

#

But it says need min 2gb

#

So

#

I wqnted to ask

opal plank
#

still tho, whats that related to this channel?

restive furnace
#

i play anythiing with 6 GB of VRAM

quartz kindle
#

system reqs are just a formality, they are not necessarily true nor accurate

#

you have to actually test the game in a specific gpu model to see how it actually runs

opal plank
#

im not saying you should pirate it before you buy it to test it, but yeah

quartz kindle
#

theres a lot of videos on youtube of people testing games in various gpus

woeful pike
opal plank
#

i mean, in the end he'll buy it, probably

quartz kindle
#

maybe

opal plank
#

wait i thought xet was commenting about my recommendation to use pirated stuff

#

yes, haskell

restive furnace
#

if haskell haves a GC it's nono for me

quartz kindle
#

regardless the best way to know if a game will run on your pc is to check videos of other people running the same game in the same specs as your pc

opal plank
#

panicked there for a second, didnt even see what the reply was

woeful pike
#

haskell good

opal plank
#

indeed

#

functional programming can be quite powerful

copper cradle
#

I kinda want to try clojure

#

that syntax seems smexy

lusty quest
#

how did you call the informations from the database?

#

also did you cache stuff?

#

and is the Web interface directly integrated into the bot?

#

looks like caching

#

did you cache the config somewhere?

#

bcs it looks like a caching issue

#

idk how its cached, mongodb should only have the keys in cache, and it doesnt looks like you have some other caching within your db call

#

unless your function for creating Guilds contains some caching

tardy hornet
#

i wanna edit an embed, is it embedname.edit(another embed)

#

?

tall pine
#

Hi. I have an sql file that is running since 30 minutes and 50 mbytes big. Is this normal?

lusty quest
#

messageobject.edit(newembed)

cinder patio
tall pine
tardy hornet
lusty quest
tardy hornet
#

yes

cinder patio
lusty quest
#

then you have to use the message object not the embed builder

tardy hornet
lusty quest
#

how did you get it?

tardy hornet
#

wdym how did i get it

lusty quest
#

you have to define it somehow

tardy hornet
#

yes i did

#

w/const

lusty quest
#

and where does it reference to the message you want to edit?

tall pine
tardy hornet
cinder patio
#

I mean... I guess it's normal, it's size hasn't reached the old db's

lusty quest
#

if its in the same command you could do```js

const embedmsg = message.channel.send(embed)

embedmsg.edit(newembed)

quartz kindle
#

30min does sound slow tho

lusty quest
#

if its seperate you have to fetch the message

tardy hornet
#

k i get it now

#

ty

tall pine
quartz kindle
#

highly doubt the problem is cpu

lusty quest
quartz kindle
#

either your disks are slow or your query is inefficient

tall pine
tardy hornet
#

@lusty quest it says:

goalembed2.edit(goalembed3)
^

TypeError: goalembed2.edit is not a function

lusty quest
tardy hornet
summer acorn
#

await

#

or .then()

tardy hornet
#

o

tall pine
#

wtf cpu at 0.1

summer acorn
#

message.channel.send() returns a promise

viral plover
#

Did the update change something about how classes are declared or used?

summer acorn
#

you gotta await that promise to get the actual message object

lusty quest
vivid fulcrum
#

what is the update

viral plover
vivid fulcrum
#

no, a library cannot change language syntax

summer acorn
#

or you can do message.channel.send(embed).then(msg => msg.edit(embed2))

vivid fulcrum
#

the class names have changed in v12 though

viral plover
#

Then uh, is there a way to get it to spew out an error instead of silently crashing in js?

tall pine
vivid fulcrum
#

if there's a syntax error, the code won't run in the first place

viral plover
#

Indeed.

viral plover
#

One of my classes that worked fine pre-update now causes the bot to just stop completely.

quartz kindle
#

which one

#

any error? if so, show error

tardy hornet
vivid fulcrum
#

you're being incredibly vague πŸ˜•

#

my discord just had a stroke ok

lusty quest
quartz kindle
#

you put it in an interval lol

summer acorn
#

for some reason, after I run this code, the shard crashes https://pastebin.com/83SfpeEY and sentry isn't being very helpful, it isn't showing any errors
when I run it locally, it doesn't output any errors either, it just simply crashes the shard

viral plover
quartz kindle
#

.catch(err => err)

#

thats why they are not showing

pale vessel
#

om nom nom

#

delicious errors

summer acorn
#

but those are only on the webhook sends

quartz kindle
#

put some console.logs in key points of the code

#

see until where the code runs

summer acorn
#

I don't have access to the logs

quartz kindle
#

wat

summer acorn
#

ravy doesn't give me that

#

because of private stuff on the dedi

quartz kindle
#

πŸ€”

earnest phoenix
#
random_number = random.randint(int(amount) - (int(amount)*0.2), int(amount)*2)``` `non-integer arg 1 for randrange()`
summer acorn
#

so sentry is my only way to see the errors on the dedi

quartz kindle
#

then use console.error

#

should show up in sentry

summer acorn
#

wait that shows up in sentry?

quartz kindle
#

it should

#

it outputs to stderr

summer acorn
#

I see, I'll try it then

quartz kindle
#

which is the standard way to get error logs

tardy hornet
#

that it will just auto update the message every 3s

#

it shows the guilds number

cinder patio
#

Also are we going to talk about that singleton class πŸ˜†

#

why not just a function

quartz kindle
tardy hornet
quartz kindle
#

wat

tardy hornet
#

and what if i'll put it in the ready event then?

quartz kindle
#

you can do that yes

tardy hornet
#

yes okay but idk what to do

#

im lost

#
const goalembed = new Discord.MessageEmbed()
                    .setColor(bsc)
                    .setDescription(`Servers count:\`${bot.guilds.cache.size}\`\n Goal: 75`)
                    .setAuthor("last time updated:")
                    .setTimestamp()
                    const goalembed3 = new Discord.MessageEmbed()
                    .setColor(bsc)
                    .setDescription(`Servers count:\`${bot.guilds.cache.size}\`\n Goal: 75`)
                    .setAuthor("last time updated:")
                    .setTimestamp()
                    
                    setInterval(() => {
                      const goalembed2 = await message.channel.send(goalembed)

                    goalembed2.edit(goalembed3)
                    }, 3000);

this is what i got @quartz kindle

#

and its non stop sending the embed

quartz kindle
#

because you made it send every 3 seconds

tardy hornet
#

ik

#

to test it

lusty quest
#

and there is a cache

tardy hornet
quartz kindle
#

then stop sending

lusty quest
#

just write back into the cache if you update stuff

tardy hornet
#

it wont work

quartz kindle
#

you have the send inside the interval

#

so it will always send

#

put it outside

tardy hornet
#

so like

#

const goalembed2 = await message.channel.send(goalembed)
setInterval(() => {

                goalembed2.edit(goalembed3)
                }, 3000);
#

?

quartz kindle
#

yes

tardy hornet
#

but

#

message is not a thing in ready event

#

so i cant put const goalembed2 = await message.channel.send(goalembed)

#

@quartz kindle

quartz kindle
#

no you cant

#

if you want to always update the same message

#

you need to save the id of the message somewhere

#

like a file or database

#

then fetch the message and continue editing it

summer acorn
# quartz kindle put some console.logs in key points of the code

I tried it locally since sentry didn't catch the console.errors

apparently it crashes here

                        console.error(8)
                        if (res.premium.enabled === true) {
                            while (res.time <= Date.now()) {
                                res.time+=res.timer;
                                collectionGuild[1]+=res.timer;
                            }
                        } else {
                            while (res.time <= Date.now()) {
                                res.time+=1000*60*60*24;
                                collectionGuild[1]+=1000*60*60*24;
                            }
                        }
                        console.error(9)
#

but that's weird, because it handled that just fine earlier

quartz kindle
#

the 9 is never logged?

summer acorn
#

nope

#

and the shard crashed

quartz kindle
#

so you have an infinite loop

summer acorn
#

but like, it didn't loop infinitely in the past

quartz kindle
#

try logging res.time

#

inside both loops

viral plover
# viral plover Wait, it's suddenly working better. <:waitWhat:622740549673418782>

I was wrong about where the code was stopping. >_>

I'm having trouble fetching a member from a guild.
.catching it isn't working either. (I'm not getting any errors, it just crashes)
I double checked that the guild is being properly fetched and the member id is correct (and a string). My syntax is the same as the example in the documentation so I have no clue.

#

Wait.
Maybe I'm just wrong about where it's stopping again somehow..?

summer acorn
#

Tim, would perhaps this work rather than a loop?

#

well, rather/better/faster

viral plover
#

If I try to log the member while fetching them it crashes earlier so I don't think I'm somehow making that mistake again.

cinder patio
quartz kindle
#

why is hour *16

placid meadow
#

that some deep code there holy crap πŸ˜„

summer acorn
#

just used it as an example

#

for when the number is 16 hours behind Date.now()

quartz kindle
#

you want to get the timestamp for exactly 16 hours before now?

summer acorn
#

and I found out that equation didn't work

#

so like,

#

it happens a lot that for example the date stored may be like 20 days behind

#

because they kicked the bot then readded it

#

I then want to set the date back to after the current date, but still keeping the same time of the day

#

so like, if the date stored in the database is 22:34:33 for example

#

I want it to stay that way

quartz kindle
#

so change 4pm 20 days ago to 4pm today

summer acorn
#

well, 4pm tomorrow if it's after 4pm today

#

4pm today if it's before 4pm today

quartz kindle
#

i see

#

yes its gonna be much faster with math

#

your code is not too far off, just needs a few tweaks

summer acorn
#

alright, now I'll need an equation that'll work since when I tested mine further, it didn't work very well

quartz kindle
#

1 day = 86400000ms

#

timestamp % 86400000 = time of the day

#

then timestamp - (timestamp % 86400000) = 0 hours of current day

#

then do 0 hours of current day + time of the day

summer acorn
#

I see, I'ma test it out real quick

quartz kindle
#

and finally add the check if the result is bigger or smaller than Date.now()

#

if its smaller, add plus 86400000

#

do it before the rendering step

#
let member = await guild.members.fetch(memberid);
ejs.render(ejs_file, {data: member})
#

or something similar

earnest phoenix
#

Is there anyway i could make an if statement that the chance for it to be true is 50/50

quartz kindle
#

if(Math.random() > 0.5)

earnest phoenix
#

how does that work?

quartz kindle
#

assuming you're using javascript

#

are you?

earnest phoenix
#

No, im using py

quartz kindle
#

then look into the random number function in py

#

example:

random.random()
Return the next random floating point number in the range [0.0, 1.0).

#

it returns a random number between 0 and 1

#

so check if the number is bigger or smaller than 0.5

#

the chances of it being bigger or smaller than 0.5 are 50/50

unreal kiln
#

i want to add nfsw command to my bot are there any nfsw command packages that are accepteble with top.gg

quartz kindle
#

no, top.gg does not accept nsfw

#

you can add it in your bot, but you cannot say anything about it in your bot description

earnest phoenix
#

dank memer has nsfw commands and its in top.gg

quartz kindle
#

it has to be hidden

earnest phoenix
#

isnt it

lavish bramble
#

zerotwo bot has nsfw commands right

quartz kindle
#

you can have them as long as they're hidden

#

not in the bot description

lavish bramble
#

Oook

pale vessel
#

dank memer has it in its description since it was there before the rule was enforced

#

according to a mod

lavish bramble
#

Oooooo ic

lyric mountain
placid meadow
#

what language is that ?

lyric mountain
#

looks like javascript

pale vessel
#

ejs?

placid meadow
#

but what are those <% i wonder

pale vessel
#

Embedded JavaScript

placid meadow
#

oww i see

#

like <[CDATA> ?

lucid prawn
#

how do i make a status go after the other

pale vessel
#

forEach doesn't support async well, you might want to use a for loop instead and members.fetch() returns a promise so await that too

placid meadow
#

i tried to make a text scroller for the gameText ,

#

kinda works

#

but u cant overkill it with too many updates, API will reject it

summer acorn
#

@quartz kindle for some reason this gives 3235324864416 which is July 9th 2072, but then when I do it in Chrome console, it works as expected

placid meadow
#

@drifting wedge ever seen a bot do this?

#

πŸ˜‰

summer acorn
#

this is it in the chrome console where it works as expected

placid meadow
#

scans images for known objects

pale vessel
#

guild is undefined

#

it might not be cached

#

side note, you're awaiting guilds.cache.get() which is redundant

ember wedge
summer acorn
ember wedge
#

seems right πŸ˜‚

summer acorn
#

alongside that, js doesn't use system time

placid meadow
#

@summer acorn whats that ?

pale vessel
#

Date.now() is milliseconds after epoch and it's in UTC

placid meadow
#

clock ?

ember wedge
#

where does the res object get the time attribute?

placid meadow
#

most operating systems use a rtp protocol to sync time, nowadays

ember wedge
#

if you've run this multiple times it seems like you would just keep adding to it

#

which could explain why it's now 2072

summer acorn
#

Lamb, I am not a new developer. I would've known it when I am looping my code.

ember wedge
#

so res.time is empty?

pale vessel
#

don't use forEach, use a for loop

summer acorn
#

alongside that

ember wedge
#

i'm just stepping through the code

lyric mountain
#

forEach = bad in every possible scenario

#

actually, is there any reason to use it over normal loop?

placid meadow
#

why is that ?

pale vessel
#

concurrency

#

yes

#

i used a for loop to handle stuff with presence update and it slowed down my bot

#

forEach works fine in that situation

quartz kindle
#

the difference between for and forEach is that forEach is basically a for that creates functions

#

like ```js
for(...) {
f = function() {
do something
}
f();
}

#

thats basically what forEach does

#

so you cannot affect the loop itself from inside a forEach

#

you can only affect the function

#

so you cannot break it, you cannot skip it, you cannot await it

summer acorn
summer acorn
#

oh true

#

I completely forgot to change that

lyric mountain
# placid meadow why is that ?
#

too lazy to search more sources tho

placid meadow
#

thx bud

quartz kindle
#

you are using a for loop now, not a forEach

#

which means

#

a return will kill the entire loop

#

to skip a particular iteration in a for loop use continue instead

pale vessel
#

also since you're getting the guild from your bot, why not use guild.iconURL() and other methods for convenience

lyric basin
#

Do you guys know a good bot for reaction roles? I’ve been looking for one and I can’t seem to find a good one?

lyric mountain
#

zyra maybe?

quartz kindle
#

i havent tested many so i cant say, but im using yag

lyric basin
#

Alright cool! Thank you!

umbral skiff
#

hi

#

i have discord bot

#

run with linux

#

Sound cutting

#

why?

#

I am using pm2 to run

#

cpu usage 17%

pale vessel
#

you're back using forEach, why?

vague yacht
#
    #handle() {
           ^

SyntaxError: Unexpected token '('
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/runner/Flusic/node_modules/wio.db/index.js:1:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)```
#

help m eou

#

gt

#

need help

feral aspen
#
var printNumTwo;
for (var i = 0; i < 3; i++) {
  if (i === 2) {
    printNumTwo = function() {
      return i;
    };
  }
}
console.log(printNumTwo());

How does this return 3, I don't understand.

feral aspen
#

What?

vague yacht
#
var printNumTwo;
for (var i = 0; i < 3; i++) {
  if (i === 3) {
    printNumTwo = function() {
      return i;
    };
  }
}
console.log(printNumTwo());```
#

@feral aspen try that

feral aspen
#

Don't change, I'm just asking why it returns 3.

pale vessel
#

because you're using var i

feral aspen
#

I know let makes it return 2, but why when I use var, it returns 3?

pale vessel
#

it'll return the last value since var hoists

feral aspen
#

Ohhh

#

It's like 3, but doesn't do the loop since the condition is false?

#

.. and if I use let, it won't work either way since it's only for the main {}, right?

pale vessel
feral aspen
#

πŸ‘ πŸ‘ πŸ‘

pale vessel
# feral aspen Ohhh

The === 2 part works but the loop still keeps on going so it will still increment i since it's var

#

by the time the loop ends, i will be 3

feral aspen
#

πŸ‘

#

I got it, thanks! :)

#

Thanks for the help.

vivid fulcrum
#

use a for loop

#

forEach won't block and wait for your promises to resolve

#

forEach is also worse in performance by a margin

#

compared to for

vivid fulcrum
#

you're not understanding what i'm saying

#

i'm mid workout trying to explain this lmfao

#

forEach should be used only for side effects

#

things where you're not supposed to return anything

#

and even then

#

a for loop is preferred

#

migrate to a for loop

vague yacht
#

@vivid fulcrum can you help me

vivid fulcrum
#

you have a syntax error

#

oh

#

not you

#

one of your node modules

pale vessel
#

@vague yacht what node version are you on

vivid fulcrum
#

jesus fucking christ that package is garbage

#

it's just a glorified json/yaml database

#

without any concurrency locks

#

use a proper database like sqlite

#

(quickdb if you're lazy)

misty sigil
#

ew

pale vessel
#

it's still sqlite

#

so > json

earnest phoenix
#

Just use postgres smh

pale vessel
#

sqlite is good

#

why go overboard

#

i don't think they have a big project

vivid fulcrum
#

and probably won't have in the future

misty sigil
#

yea not if they're using a json/yaml database

pastel tulip
#

,

#

Can I Get help πŸ™‚

#
client.on('message', message => {
  if (message.conetent === prefix + "deletet"){
    if (!message.member.hasPermission('MANAGE_GUILD')) {
      message.channel.send(`**❌You Dont Have Permission MANAGE_GUILD❌**`);
      if(!message.channel.name.includes("ticket-")) return message.channel.send("**:x: | This is Not Ticket Channel**").then(msg => {   msg.channel.delete()
    }
})```
Why This Shit isnt Work ?
vivid fulcrum
#

debug the shit

tacit sequoia
#

content*

earnest phoenix
#

message.conetent

pastel tulip
cloud warren
#

Error: Could not locate the bindings file. Tried:
I am getting error I tried many solutions I could not do what can I do

earnest phoenix
#

You trying to install better-sqlite3?

cloud warren
#

yes Δ± try

#

but not work

vague yacht
vivid fulcrum
#

...you have your own node fork?

pastel tulip
#
client.on('message', message => {
  if (message.content === prefix + "deletet"){
    if (!message.member.hasPermission('MANAGE_GUILD')) {
      message.channel.send(`**❌You Dont Have Permission MANAGE_GUILD❌**`);
      if(!message.channel.name.includes("ticket-")) return message.channel.send("**:x: | This is Not Ticket Channel**").then(msg => {   msg.channel.delete()
    }
})```
This Shit Still Not Working
misty sigil
#

bro

pastel tulip
#

Waht ?

misty sigil
#

fix your syntax

#

and is that one message event per command

#

what the fuck

unreal estuary
#

why

#

a message event for each command?

#

just put them all in the same evemt

misty sigil
#

and the file

#

is 754 lines long at least

#

what the fuck

unreal estuary
#

who did that

misty sigil
earnest phoenix
#

Not having a command handler is stinky

vivid fulcrum
#

fr though

#

i sometimes just think of nice patterns in my head for js command handling... even though i've never written a js bot

#

and then you see if else

earnest phoenix
#

if else if moments

#

YandereDev style

vivid fulcrum
#

yandev would be proud

earnest phoenix
vivid fulcrum
#

lMFAO

pastel tulip
#

i Fix It Thx ._.

marble juniper
vivid fulcrum
#

but there I can't use await
sure you can

#

your framework should definitely support async rendering

#

i'm guessing you're using ejs

#

a google search yields this

#

you didn't even click on the link πŸ™„

opaque acorn
#

Does anyone know why sometimes I get the same command twice?

sudden geyser
#

Please provide more details.

still flower
#

Is the command sending twice? Is it coming up twice?

opaque acorn
#

when I send the command in discord sometimes it repeats

#

Like this

#

?avatar

#

AVATAR DE TOUMAsenpai

#

AVATAR DE TOUMAsenpai

#

Two times

still flower
#

Do you have two instances of your application running?

opaque acorn
#

No

still flower
#

How sure are you of that

#

Can you show your code for the command?

opaque acorn
#

Ok

#

Wait a min

#

const Discord = require("discord.js");

module.exports = {
name: "avatar",
description: "Mostrar avatar de un usuario.",
aliases: ['a'],
category: 'Entretenimiento',

async execute(client, message, args) {
let member = message.mentions.users.first() || message.author;

let avatar = member.displayAvatarURL({ dynamic: true, size: 4096 });

const embed = new Discord.MessageEmbed()
  .setTitle(`Avatar de **${member.username}**.`)
  .setImage(avatar)
  .setColor("RANDOM")
  .setFooter(`Pedido por ${message.author.username}.`);
message.reply(embed);

}
};

earnest phoenix
#

does any other command repeat twice

opaque acorn
#

Yes

#

All

earnest phoenix
#

there is most likely two instances of your bot

#

how are you starting your bot?

opaque acorn
earnest phoenix
#

is it via your code editor?

opaque acorn
#

Yes

earnest phoenix
#

ok can you screenshot the terminal

#

i wanna see how many are open

opaque acorn
#

Ok

#

I'm in mobile now

#

A

#

Right

earnest phoenix
#

ok right here, click it and if it shows two node instances, then delete one terminal

opaque acorn
#

I have the project in glitch

earnest phoenix
#

i.e. the bin icon

#

bruh

#

well if it's a node instance issue, I wouldn't know how to help

#

what file do you start

#

send the code for that

opaque acorn
#

I also send you the command and event handler?

sterile lantern
#
    let user = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
    const reason = args.slice(1).join(" ")
        punishments.findOne({ GuildID: message.guild.id, UserID: user.user.id}, async(err, data) => {
            if(err) throw err;
            if(data) {
      let array = data.Punishments.map(
                            (v, i) => 
                            '**__Case ID:__** `' + `${v.CaseID}\n` + '`**Moderator**: ' + `<@${(v.Moderator)}>` + '\n**Date**: `' + v.Date + " EST`" + '\n**Reason**: `' + v.Reason + '`\n**Type:** `' + v.PunishType + '`'
                        )
let on = 0;
let content = "";
for (let v of array) {
   on++;
   if (on == 6) {
       on = 0;
        let abc = new Discord.MessageEmbed()
                    .setTitle(`${user.user.tag}'s Moderation History`)
                    .setDescription(
                        content
                    )
                    .setColor("BLUE")
                    .setFooter("Moderation Logs")
                message.channel.send(abc)
              
   } else {
      content = content + v + "\n";        
   }
}
   if(content !== "") {
    let abc = new Discord.MessageEmbed()
                    .setTitle(`${user.user.tag}'s Moderation History`)
                    .setDescription(
                        content
                    )
                    .setColor("BLUE")
                    .setFooter("Moderation Logs")
                message.channel.send(abc)
   
   }
} else {
                let noData = new Discord.MessageEmbed()
                .setTitle(`${user.user.tag}'s Moderation History`)
                .setColor("GREEN")
                .setDescription(`This user has no moderation history so far!`)
                .setFooter("Moderation Logs")
                message.channel.send(noData)
            }

        })
    }
}```

so basically this just makes it so it displays 6 cases at a time.
#

if a user has 12 cases, it'll split into two embeds, but it doesn't do that here, instead,

#

it sends it weirdly

#

one sec

#

it sends duplicates

#

it works fine for users who have like 6 cases only

winged fractal
#

Have you reached the max field limit

#

It might be glitching out

sterile lantern
#

yeah i presume so

#
(node:101) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.description: Must be 2048 or fewer in length.```
#

i get this error

#

but

#

i want it to split by 6 cases per embed

#

but it sends like 10

#

which causes the error

vivid fulcrum
#

flush your content

#

aka reset it to an empty string

winged fractal
#

Oh wait

vivid fulcrum
#

when you hit 6 cases

winged fractal
#

Yoyr making 3 embeds

#

You are making a new embed

#

3 times

sterile lantern
#

yeah thats if certain conditions are met

#

first condition - if user has 6+ cases, split

vivid fulcrum
#

that code is a mess

sterile lantern
#

2nd condition less that 6 cases, send as one

winged fractal
#

Just redo the code

sterile lantern
#

3rd condition - no cases, send embed

winged fractal
#

I agree, the code is a mess

#

Its best to just redo it

sterile lantern
#

hmm

#

ok

winged fractal
#

Or try to indent it properly

sterile lantern
#

so looking at the issue, it sends one embed with 6 cases

#

and then sends the rest without a limit

#

i think its an issue with the first condition

winged linden
#

Make a pagenation system show 6 in each page

vivid fulcrum
#
//FIRST check if there aren't any cases, don't waste processing power
if(data.Punishments.length == 0) 
{
  //no cases embed here
  return;
}
//this should be a const! this data does not mutate and doesn't have any reason to
const array = map(...);

let content = "";

for(let i = 0; i < array.length; i++) {
  const _case = array[i];
  
  if(i % 6 === 0) {
    //we've hit 6 cases here, send the embed
    //fliuh the content
    content = "";
    continue;
  }

  content += `\n${conjoin the case here idk format it however youd like}`;
}
#

follow this pseudo

sterile lantern
#

what does fliuh mean

vivid fulcrum
#

your original code is a mess

#

flush*

sterile lantern
#

oh

#

ok

#

ty

vivid fulcrum
#

it isn't entirely correct though

#

you also need a condition to check if i + 1 is equal to the length of the array, if so, we've hit the end of the array, send the content

winged linden
vivid fulcrum
#

that's false

#

the modulo operator is there for a reason

vivid fulcrum
#

i didn't want to provide all of the logic in the snippet

woeful pike
#

uh are you trying to break the embed into in 6?

winged linden
#

Much better

vivid fulcrum
#

i'm aware

sterile lantern
sterile lantern
#

yeah im testing that rn

#

i just answered the question

#

lol

woeful pike
#

lodash has a function for doing this

const pages = _.chunk(array, 6)
vivid fulcrum
#

that takes the fun away

#

also lodash :(

woeful pike
#

there's no point in not using lodash lol

#

especially when the js standard library is basically non existent

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

Just

(array, length) => Array.from({
  length: Math.ceil(array.length / length)
}, (_, i) => array.slice(i * length, i * length + length))```
vivid fulcrum
#

i wonder how much slower that is

woeful pike
#

what the hell

past dove
#

Please help me

vivid fulcrum
#

did you read the error

past dove
#

yes but i dont know how i can write it into json file

vivid fulcrum
#

which package are you trying to install

past dove
#

./constants

vivid fulcrum
#

what's the url of it

sterile lantern
#

are you trying to install something from your pc...?

past dove
#

I don't know πŸ™„

sterile lantern
#

./constants wouldnt even work-

#

i-

#

that isnt a package error

#

that means it cant find the file named constants

#

well not file, module

#

did you do

#

const something = require(./constants)

vivid fulcrum
#

no

#

read the stacktrace

#

the error is internal

sterile lantern
#

o

vivid fulcrum
#

which means they either messed with node_modules or stopped/killed npm while it was installing something

drifting shell
#

guys guys guys
spaces or tabs

vivid fulcrum
#

spaces

earnest phoenix
#

Spaces

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

livid lion
#

Lmao

past dove
#

@sterile lantern @vivid fulcrum Thanks for help ! I repaired it

earnest phoenix
vivid fulcrum
#

without the s

earnest phoenix
livid lion
#

without the a

broken matrix
#

Is there a way to make my bot log the console to a channel

#

*Discord.js

vivid fulcrum
#

don't

#

why would you want to do that

quartz kindle
#

is there a way? yes
is it stupid? yes

livid lion
broken matrix
#

If i was away from home id like the other devs from my bot to see what was wrong or how the bot is

misty sigil
#

there is a way but the idea you've proposed is entirely fucking stupid

broken matrix
#

@earnest phoenix right?

vivid fulcrum
#

if you want to log errors

#

use a service like sentry

vivid fulcrum
#

discord is not a place to log

broken matrix
#

No like if i away from home

earnest phoenix
#

the same staff wants to see on his bot

broken matrix
#

id like to see the issue and give a reason on why

misty sigil
#

ratelimits

vivid fulcrum
#

✨ sentry ✨

misty sigil
#

and pure stupidity

vivid fulcrum
#

sentry was literally built for this

earnest phoenix
#

any good bot doesn't have an error every 0.6 seconds

broken matrix
#

buddy im not asking that im asking how to do it

misty sigil
#

WHY WOULD YOU DO IT

vivid fulcrum
#

you don't do it

#

that's how you do it

#

:wesmart:

misty sigil
#

augh i had caps on

vivid fulcrum
#

like i said

#

use sentry or a service similar to that

misty sigil
broken matrix
#

Nice

#

what bot is to your name

earnest phoenix
#

I'm not trying to I have coded it

#

Staff wanted to see it he's asking for .js I use .py

misty sigil
#

use sentry

broken matrix
misty sigil
#

yea

broken matrix
#

dude im 14 i dont have but 500 bucks on my card

misty sigil
#

you can self host it

broken matrix
#

i dont want to pay for this

misty sigil
#

or use it for free

vivid fulcrum
#

sentry has a free plan too lol

broken matrix
#

oh

#

retard alert

craggy pine
#

We use sentry would recommend

vivid fulcrum
#

pretty much any sane developer does

#

for prod apps

craggy pine
#

We didn’t until recently n we have almost 10k servers kekCoffee we are not sane devs

misty sigil
#

are any devs sane

craggy pine
#

Facts

vivid fulcrum
#

good point

#

there are two paths of developer insanity

#

incapable of social interaction
or
programming socks

craggy pine
#

Why not both

vivid fulcrum
#

also a good point

craggy pine
#

If you’re not insane are you even a dev

sage bobcat
#

One message removed from a suspended account.

misty sigil
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

misty sigil
#

or are you

vivid fulcrum
#

i love that moment of realization within the second of posting it

blissful coral
#

That's my brain

#

nvm

#

I borked it

#

ejs be like

earnest phoenix
#

Hello all

twilit pollen
#

uh so i'm kinda desperate

#

hope someone can fix this issue

if(command == 'oxford'){
                var definition = "default"
                //get use requested word and null check
                let userword = args.find(arg => arg.name.toLowerCase() == 'word').value;
                 if(!userword)return;
                 //use oxford dictionary to find JSON
                 let lookup = dict.find(userword);
                 lookup.then(function(res){
                     //stringify and parse data
                     let data=(JSON.stringify(res,null,4));
                     let object = JSON.parse(data);
                     //get definition from JSON object
                     definition = defenitionGET(object); // !!!!!defenition after the GET is defined!!!!!
                     //use function to call discord api and send reply (i'm assuming this is where it goes badly) 
                     return sendreply4(client,interactie,definition);
                    },function(error) {
                     return console.error(error);
                 });
            }

function

function sendreply4(client,interactie,data) {

    client.api.interactions(interactie.id,interactie.token).callback.post(
        {
            data:{
                type:4,
                data: `${data}`
            }
    });

}

error

error DiscordAPIError: Invalid Form Body
data: Only dictionaries may be used in a ModelType
// 
//some internals
//
 method: 'post',
  path: '/interactions/828774663244...,
  code: 50035,
  httpStatus: 400
#

and i have no idea

simple zodiac
#

Hey sorry if this is the wrong place to ask, but, does anyone know of a good api / any good way to do an ascii command? I'm using Discord.js and I haven't really been able to find one ACOSP_catcry

vivid fulcrum
#

what is an ascii command

simple zodiac
#

i used it there

vivid fulcrum
#

oh

simple zodiac
#

yeah

vivid fulcrum
#

look for a figlet library for your language

simple zodiac
#

alright ill see

vivid fulcrum
#

yup

simple zodiac
#

pretty sure had to make sure tho

#

kk

#

thank you

gloomy idol
#

Hello

simple zodiac
#

Took me a little bit but i got the ascii command to work, thanks pe

earnest phoenix
#

Anyone available for a quick python question?

sage bobcat
#

One message removed from a suspended account.

wicked pivot
#

hello, I have a problem I would like to set a Thumbnail with an image retrieved with an url but the url does not work because it does not end in jpeg, png

vivid fulcrum
#

...so give it a url that returns an image

#

the urls don't care about the extension

#

but whether the url returns a valid image or not

wicked pivot
#

it only returns an image, I can send you a private example link if you want

vivid fulcrum
#

can you send it here

wicked pivot
#

here it is automatically put in image but I can not put it in an embed

vivid fulcrum
#

works here

wicked pivot
#

ah it must be an error in my code so, excuse me

drifting wedge
#

how do i call a command function in dpy from a different file while using the ctx param?

#

to explain it, i have a webserver running in a cog

#

and i need to basically run commands

#

via the webserver api

#

and on some commands i need to pass ctx

earnest phoenix
#

Get the command using <Bot>.get_command. Since Command object implements __call__ method, you can call it directly. You can also run it using ctx.invoke

vivid fulcrum
#

why not just abstract the logic from the command

earnest phoenix
#

Uhh, ctx is made up of a discord.Message, I don't think you can get one if it was from the webserver

drifting wedge
#

bc its for a music command

#

specifially stop

vivid fulcrum
#

...so?

drifting wedge
#

so it stops the ctx

#
        player.queue.empty()
        await player.teardown()```
#

how it works

#

it uses the ctx to get the player

earnest phoenix
#

I mean, you can make another method that does that without the need of ctx, and then make a command that calls that method

drifting wedge
#

ye good idea

vivid fulcrum
#

which is literally what i said

#

πŸ˜”

earnest phoenix
#

yeah I just re-word what cry said

#

You can also make a proxy object, see what get_player needs from the Context object, most likely just guild_id, then you can make an object that has that attribute and pass it there Β―_(ツ)_/Β―

drifting wedge
#

via ctx

#

but ill try an alternative id method

#

thanks guys

waxen bough
#
2 low severity vulnerabilities

To address all issues, run:
  npm audit fix
#

i've typed npm audit fix still there

#
fix available via `npm audit fix`
node_modules/minimist
  optimist  >=0.6.0
  Depends on vulnerable versions of minimist
  node_modules/optimist
#

npm audit fix does nothing

woeful pike
#

you can't upgrade because another dependency requires a vulnerable version of the dependency you're trying to upgrade

waxen bough
#

is there a way to know dependent packages?

woeful pike
#

it shows you right there

waxen bough
#

probable another dependency

woeful pike
waxen bough
#

apparently jsbeautify

woeful pike
#

that is a very old version of jsbeautify :)

waxen bough
#

wth

woeful pike
#

probably a dependency of another dependency

#

anyways, welcome to javascript

slim umbra
#

use rust asnd ur problems will go away WeSmart

waxen bough
#

i didn't even noice i have 2 of them installed

#

jsbeautify and js-beautify

#

i guess jsbeautify is vulnerable one because i still have the other one installed but the issues are gone

waxen bough
woeful pike
#

oh just use prettier

earnest phoenix
#

Can anyone guide me how to leave my bot server's at once

sudden geyser
#

You want to mass leave all servers your bot is in?

earnest phoenix
#

Yep

#

Is it api abuse?

sudden geyser
#

It'll likely be API abuse since you'd be sending a lot of requests in a short period of time, but it's quite easy to do.

#

You'd just need to iterate over all guilds your bot has and send an API request to leave the guild

earnest phoenix
#

Just for education purpose I waana do

#

exam code πŸ™„

snow urchin
#

why is this giving a 400

placid meadow
#

is the url properly setup ?

#

inline variables correct and all that

#

400 is a bad request code

#

so i rekon something is missing

#

@snow urchin

snow urchin
#

docs

placid meadow
#

sometimes (myself at least) i setup a console.log to see if the urls are properly done

#

before i send them down the pipes

#

just to be sure

#

might have missed something, ya know how it goes

#

im not a js/nodejs coder, but i assume the mechanics are the same if i would do it in my lang

snow urchin
#

Ok, I logged url, it is 100% correct

placid meadow
#

ok

#

is there a way to test this on a browser?

#

to verify this url works

#

so u can isolate the problem, is it the server or is it my header body

#

thats the question

#

i assume the data:data1 is the payload ?

#

also, isnt it usually send with json format ?

#

or am i wrong on that

#

i dont know the docs on this

earnest phoenix
#

Hello

#

anyone here willing to answer a question

sharp ledge
#

btw can bot know the person who invite our bot to the guild?

sharp ledge
placid meadow
#

it could, if you hook the "Join" event

sharp ledge
#

guildCreate event?

earnest phoenix
placid meadow
earnest phoenix
#

I'm having trouble with the highlighted section. I thought "earnings" was my variable but it dosent seem to be

sharp ledge
placid meadow
#

u can also track and store guilds in a db like file so you have a reference

#

im not a nodejs coder, but i assume these events are basically universal

sharp ledge
#

i see, will check that later πŸ‘

sharp ledge
earnest phoenix
#

Sadly....I am very amateur

#

I appoligize

sharp ledge
#

me too πŸ˜†

earnest phoenix
#

Lol

#

Any advice?

#

On what variable could.be? It's clearly not earnings

sharp ledge
#

if you have no purpose, you can just disable // that line code

earnest phoenix
#

No i have a list.of work_messages that I'm trying to pull from.

#

But I cant figure out how to.make.that earnings part

wicked pivot
#
{
  "828766292777500683": [
    {
      "ChannelID": "828812416023396392",
      "lastvideoID": "nothing",
      "channelReturn": "828766292777500686",
      "authorReturn": "363402633752477696",
      "user": {
        "ID": "6845716429242434565",
        "username": "tonykun7"
      }
    }
  ]
}```
hello, I would like to change "lastVideoID" how can I do that?
earnest phoenix
#

people were wanting to save my database logs in a txt file ex:
Database Log - [date] | [value] of [username] database [id] was removed)

near stratus
earnest phoenix
near stratus
wicked pivot
#

@near stratus
the problem is that in the array there may be other information like this

near stratus
#

If you're saving all their chat and don't actually tell em you're saving it, that's a violation of privacy

earnest phoenix
near stratus
#

Then It's not illegal I guess

earnest phoenix
near stratus
#

When you're saving currency data all you're collecting is their IDs

wicked pivot
#

I found thank you even if I did not have time to explain x)

Get[`${GUILD[UserGet.indexOf(UserGet2nd)]}`][UserGet.indexOf(UserGet2nd)].lastvideoID = lastvideo.id```
near stratus
#

wtf

earnest phoenix
#

thank you, have a good night

near stratus
earnest phoenix
#

I will try to inform this when they create an account on the bot

rose warren
# earnest phoenix was there any way I could be sure of that?

Well anything available with the API is public information so it's not sensitive information. But I would totally draw the line at storing or logging message history etc for privacy reasons (unless perhaps a log of someone's last messages in case of a ban command for example so mods can have logs of why the person was banned). Messages are private in my opinion. As long as you're not being invasive in what you store then it's ethically ok. Write a privacy policy for your users explaining what info you store and why, for how long, and what someone has to do in order to have their info deleted from your database. That way everything is transparent for everyone and your users will know what data is stored and why.

frigid mountain
rose warren
#

message.guild.channels not message.client.channels

#

Line 7

lost heath
#

message.client.channels is only used if you want to find One specific channel by id

frigid mountain
earnest phoenix
#

okay

#

thank you

frigid mountain
rose warren
#

Are you running it in DMs?

frigid mountain
#

Yea

lost heath
#

why

rose warren
#

That's why

lost heath
#

just why

woven oasis
#

Shloud be message.guild.channels.cache.find

frigid mountain
lost heath
lost heath
woven oasis
rose warren
#

@frigid mountain is your bot meant only for one guild or public for anyone to add?

lost heath
frigid mountain
lost heath
#

okay why not

frigid mountain
rose warren
#

Is it for only one guild though?

#

Because that changes how you'll handle it in DMs

lost heath
#

let channel = client.channels.cache.find(β€˜channel-id’)

#

if its only one guild

rose warren
#

let channel = client.channels.cache.get(β€˜channel-id’)

lost heath
#

or get. that works too

woven oasis
lost heath
#

try get as mac said.

#

and why do you fo channel => channel.id? just do β€˜channel-id’

#

that will work fine

#

no need for the arrow function there

#

okay. im just gonna leave. everything about that code makes me want to quit coding

tiny goblet
#

Hi umm I've been looking in discord.py documentation about bot can read your bio and detect the message in your bio, if you know this and it's on discord.py documentation can you tell me what it's called or give me the link of it thank you

dusky sundial
#

What do you mean by bio? Status?

tiny goblet
#

Yeah

#

Status

waxen cloak
#

which is the best framework on top of Eris

frigid mountain
lusty quest
#

this makes no sense, if you want to use a certain channel you have to get or fetch the channel anyways otherwise you dont get the channel object.

rose warren
#

So you need to think about how the bot will associate a user with the specific guild they want to use mod-mail in.

earnest phoenix
tiny goblet
earnest phoenix
#

I'm aware

#

That's what you need.

rose warren
#

@frigid mountain i think a ticket system is probably easier to set up both for you and for your users. A permanent reaction message where members can react to open a private channel with the server's mods.

tiny goblet
#

Oh alright someone given me a Member.status one so

#

I'll try both

dusky sundial
#

Pretty sure Member.status is just online, away etc.

earnest phoenix
#

Made it tuple to prevent it from getting stringified.

tiny goblet
#

alright thnx

rose warren
# frigid mountain Ok

Mod mail DMs work if the bot is only designed for one server. Otherwise it starts to get complicated for the users.

frigid mountain
#

Oh

summer acorn
#

ok question, what does this actually mean?

rose warren
#

Your bot has tried to connect over 1000 times

#

You're locked out

summer acorn
#

makes sense, I did connect a lot when trying to fix it yesterday

#

wait, does that include webhooks or only the bot account?

soft sluice
#

HI FOO

rose warren
#

Stop trying to connect until then otherwise it'll increase the time

summer acorn
#

well yes, but let's say the bot connects to almost 4000 different webhooks over the course of 24 hours, would that trigger it?

rose warren
#

When you say "connect" do you mean sending a message?

earnest phoenix
#

It's triggered by identifying more than 1000 times in 24 hour.

rose warren
#

Yeah it's to do with your client hitting the identify limit not webhooks. My bot got timed out for 24h last month over a glitch with an unavailable guild that created an error loop while I was asleep πŸ‘Œ so easy to fix and so annoying πŸ˜…

#

Pro tip: if you have a sharded bot and you see this error in your logs one day, DON'T restart all the shards πŸ˜… it'll put all the shards offline. Better to leave one offline than to send all of them down.

#

Because each shard = client identification obvs

summer acorn
#

yeah, my bot has 4 shards x)

#

and it has gotten timed out for 24 hours multiple times due to unavailable guilds, but the thing is I don't even know if it's repeatedly trying to restart the shard

rose warren
#

Mine was in 7 or 8 at the time doing about 300k command calls a month. Really sucked to have to wait for 24h.

rose warren
summer acorn
#

also, since it's triggered by identifying more than 1000 times in 24 hours, what about bots with more than 1000 shards

#

e.g. Groovy

rose warren
#

They have a special gateway and have their limits raised to 2,000

summer acorn
#

I see

rose warren
river panther
#

guys

#

what is better

#

sqlite

#

or mongo?

opal plank
#

last month i got around 100k commands used

river panther
opal plank
#

with queries

river panther
#

some guide?

opal plank
#

not really, just grouping with dateTrunc

river panther
#

hm, ok, let me try

opal plank
river panther
#

thamk

opal plank
#

np

river panther
rose warren
river panther
rose warren
#

Built my own dash

river panther
#

ah

opal plank
#

@river panther you should really start focusing on building your own stuff rather than pre-made stuff

#

just fyi

#

a developer, well, develops

#

create new things

#

imagine something, than make it happen

#

instead of copying something that already exists

waxen bough
opal plank
#

what bothers me isnt that you want to get your own graps

#

is that your first intuition was where can i use this

#

instead of how do i make this?

waxen bough
# waxen bough

@umbral zealot apparently i can't install enmap on replit and they have their own database. so i had to do this

pale vessel
#

tf is that formatting

#

func ( a )

river panther
pale vessel
#

statement ;

#

what the fuck

#

ew

opal plank
#

nobody starts coding without knowing

#

we gotta learn it first

#

:P

river panther
#

thamk erwin for motivating me again to do this, big fan, thank

opal plank
#

no problomo

waxen bough
rose warren
river panther
#

oh, ok ok

waxen bough
pale vessel
#

for a sec i did

#

now i don't anymore

marble juniper
#

makes it a bit more easier to design pages

#

if you ask me

marble juniper
rose warren
#

Yes bootstrap is a good starting point. I've only ever used it on one project though. I usually write my own for each project. Especially good when you're starting out though.

earnest phoenix
#

nevermind im just dumb

earnest phoenix
#

Is this correct?

client.on("guildMemberAdd", member => {
  if(member.user.bot) {
    .addRole("Role ID")
  }
})```
rose warren
#

member.addRole

earnest phoenix
#

ok

dusk skiff
#

what the problem here?

#

im new to python πŸ˜…

hasty lotus
#

is there any way to stream a video stream instead of just an audio stream using djs ?

pale vessel
#

No

hasty lotus
#

ok :/

alpine marsh
#

hello

#

i need some help with regex

#

im using a golang filter

#

im quite new to regex's and coding

#

͏[\xe1\x9e\xb5\x80\x8c\xe3\xa4\xef\xbe\x2e\xba\xb9\xb8\xb7\xb6\x9d\xb3\xaf\xae\xac\xab\xaa\xa3\xa2\xa1\xa0\x9f\x8f\x8d\x8b\x8a\x89\x88\x81\x87\x86\x84\x83\x82\x8e\xb4\xd8\x9c\xc2\xad\xe2\x85\xf0]

#

nothing matches

#

can someone help

alpine marsh
#

ok

frigid mountain
#
const Discord = require('discord.js')

module.exports = {
    name: 'send',
    run: async (message, args) => {
    const sayMessage = args.join(" ")
    const channel = message.mentions.channels.first()
    channel.send(`${sayMessage}`)
    
    }
}

Why does it mention the channel?

alpine marsh
#

i've shorterend it

lost heath
rose warren
frigid mountain
rose warren
#

Try joining args[1] and higher. Exclude args[0]

lost heath
#

oh. i read the code wrong. lol. im on phone

waxen bough
#

type .slice(1) before join(" ");

frigid mountain
frigid mountain
rose warren
#

Yeah no lol what bano said

#

I just wanted you to Google how to remove elements from an array πŸ˜‚

frigid mountain
#
var maps = { 'I': 'd.', 'C': 'd', 'M': 'd', 'D': 'd', 'T': 'd', 'O': 'd', 'C': 'd' }; var keyToDelete = 'C'; delete maps[keyToDelete]; console.log(maps
rose warren
#

That's a map not an array

#

You can use .slice() in this case

frigid mountain
rose warren
# frigid mountain ```diff const sayMessage = args[1].join(" ") ```

It's js const sayMessage = args.slice(1).join(" ")
Because args is an array containing each word of your message that comes after the command.
array.slice() will remove elements from the beginning of the array.
array.join() converts the array into a string with whatever characters you want in between each element. For example if you want to make a comma-separated list you'd do array.join(", ")

near stratus
#

what hell on earth is that thing ?
what are these <% ?

waxen bough
#

probably aspx thing idk not really sure

vivid fulcrum
#

ejs

#

it isn't related to asp

#

😭

near stratus
#

was php not enough ?
now there's more cursed things on earth

waxen bough
#

haha okay bit it's similar though

quartz kindle
#

php is a billion times better than ejs

near stratus
waxen bough
#

i don't use <?php ?> that way. I write HTML inside PHP script

#
echo "<!DOCTYPE html>\n" ;
echo "<html><body><p>asd</p></body></html>" ;
near stratus
waxen bough
#

becasue I want to load dynamic pages. i mean it's already dynamic but ..idk how to explain

near stratus
#

Anyway
Why don't they just use React instead.
If there's "TOO MUCH" js in webpage

waxen bough
#

it's actually interesting

quartz kindle
#

remember when i told you do do it before rendering?

#

you cant use async inside the renderer

vivid fulcrum
#

render also takes in async true

near stratus
waxen bough
#

huh so if I write this

<% for(let num=0;num<9;num++) {%>
  <p>count <%= num%></p>
<% }%>

the p tag gets written 9 times? is that how it works?

near stratus
quartz kindle
#

i dont use ejs but all examples i found in SO say to use async stuff outside the renderer

rose warren
#

No worries! πŸ™‚

onyx hare
timber fractal
#

why if i use this code (https://srcb.in/mK3iGK3WWa) and i run >trigger without mentioning somebody it says "cannot read property "user" of undefined" while it should take the user that runs the command their avatar?

#

someone?

waxen bough
#

i think line 12

#

mentions.members could be empty if there's no mentioned member in the message

cinder patio
#

msg.author isn't a function either

#

Also msg.author is of type User not GuildMember

waxen bough
timber fractal
#

so how can i fix it?

timber fractal