#development

1 messages · Page 2020 of 1

sudden geyser
#

You could store the deleted messages somewhere (map/memory, databaase, etc.) and just look it up.

feral aspen
#

If I haven't done that, it wouldn't be possible, right?

copper cradle
#

since when did js get private methods wut

sudden geyser
#

since a while ago

#

though no one uses them

copper cradle
#

yeah that # syntax is a bit whacky

simple stump
#

How would I reorder an array from greatest to least? Ex.

[myObject 5]
[myObject 4]
[myObject 3]
[myObject 2]
[myObject 1]

To:

[myObject 1]
[myObject 2]
[myObject 3]
[myObject 4]
[myObject 5]
solemn latch
#

.sort()?

simple stump
#

oh whoops

#

thx

deep musk
#

My bot is meant to say who hugged the user with ${message.author} but it's not working i will provide code in a min

#
const db = require("old-wio.db");
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");

module.exports = {
  config: {
  name: "hug",
  group: "fun",
  aliases: [""],
  category: "fun",
  description: "Hug a Member!",
  usage: "hug <Mention Member>",
  },
  run: async (bot, message, args) => {
    //Start

    let Member =
      message.mentions.users.first() ||
      message.guild.members.cache.get(args[0]) ||
      message.author;

    let Result = Math.floor(Math.random() * 101);

    let embed = new MessageEmbed()
      .setColor("RANDOM")
      .setImage("https://media.tenor.com/images/f7379e1268593ee9daa6c027209a9968/tenor.gif?ctx=share")
      .setTitle(` ${message.author} hugged ${Member.username}`)
      .setDescription(`${Member.username} was hugged by ${message.author}`)
      .setFooter(`Requested by ${message.author.username}`)
      .setTimestamp();

message.channel.send({ embeds: [ embed ] });
    //End
  }
};
real rose
#

You're trying to mention the autor in the title which doesnt work

deep musk
#

Oh

real rose
#

You need to use tag or displayname

deep musk
#

How do I do that?

abstract tendon
deep musk
deep musk
#

Msg is undefind

abstract tendon
#

💀mobile

#

yea I meant

#

message.author.username

deep musk
#

Omg

deep musk
plucky imp
#

okay so

#

in my slash cmd i have it so if you do /invlinks set mode:list it should send a list

#

but whenever i do it it just send the option if you choose /invlinks set mode:off

#

as shown here

#

how can i make it so instead of sending the off option it sends the list option ig

#

idk how to ask it properly

#
 const enable = interaction.options.getString('mode') === 'on';

        const list = interaction.options.getString('mode') === 'list';

        console.log(list)
  
        if(enable) {
  
          await interaction.reply({ embeds: [ onEmbed] });
    
    
          await client.db.updateGuild(
            interaction.guild.id,
            { id: interaction.guild.id },
            { $set: { modInviteLinks: 'On' } }
          );

        }else if (!enable) {
  
          await interaction.reply({ embeds: [ offEmbed] });
  
          await client.db.updateGuild(
            interaction.guild.id,
            { id: interaction.guild.id },
            { $set: { modInviteLinks: 'Off' } }
          );
    
          
  
        } else if(list) {
            const inviteHosts = [
                'discord.gg/',
                'discord.com/invite/',
                'discord.io/',
                'discord.st/'
              ];

            const embed = new MessageEmbed()
            .setColor(0xff3636)
            .setDescription(inviteHosts)
      await interaction.reply({ embeds: [embed] });
        }
#

this is the code btw

#

if it helps at all

#

@solemn latch

quartz kindle
#

you have if(enable) else if(!enable)

#

first of all that is redundant, since if enable is set, it cannot be !enabled anyway, useless to check twice for the same thing

#

second, that can only ever have 2 different options, either its enabled, or its not enabled

#

its imposible to ever have a third option the way you did it

deep musk
#
Unexpected end of input line 172```
sudden geyser
#

more details pls

deep musk
#
const Errorhandler = require("discord-error-handler"); const handle = new Errorhandler(client, { webhook: {id: `962526254446284890`, token: `T1hHU3ASnCHuTAcTFzvVgJSgG5j8yyI18mh_G4OvuMxCkLnLhIghKQxZCI1XWw5KJhzs`}```
#

The the code a the end

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

sudden geyser
#

Given what you've shown, you're missing a })

deep musk
#

Oh

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

thanks for the token, im gonna hack your bot now

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

deep musk
quartz kindle
#

gonna spam your webhook channel then

#

xD

sage bobcat
#

One message removed from a suspended account.

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

hey tim I'm on life support and need your bot token to save my life can you please give

earnest phoenix
sudden geyser
#

someone better not report me for that

deep musk
#

Still broken

quartz kindle
#

sure, my token is uvuvwevwevwe.onyetenyevwe.ugwemubwem.ossas

sudden geyser
#

ty

deep musk
sudden geyser
#

hey this isn't a token

#

when I used it my pacemaker got replaced for a microwave

quartz kindle
# deep musk

for every ( or { you have, you need an equal ) or }

quartz kindle
#

go count your brackets

deep musk
#

I fixed it

#

But it won't send my error logs

quartz kindle
deep musk
quartz kindle
deep musk
#

I got it fixed

simple stump
#

Using the user-agents package (https://www.npmjs.com/package/user-agents), how would I utilize it in axios?

var userAgent = require('user-agents');

axios.get(file, { headers: userAgent.toString() }).then(async (response) => {
  let pageContent = response.data;
  let $ = cheerio.load(pageContent);
  let image = $('img').attr('src');
  await downloadFile(image, path);
}).catch((err) => {
  console.error(err);
});
deep musk
#

I got logged out of my main

quartz kindle
#

i dont remember you, but anyway, my answer was based on you having difficulty with something as basic as brackets, and the snippet of code you posted looked nothing like how the documentation for discord-error-handler shows

deep musk
#

I kinda used my own way

quartz kindle
plucky imp
#

sadge

#

how can i change it so i can then?

quartz kindle
deep musk
#

Uh I keep getting this

#

I can't find what is causing it

quartz kindle
#

you're trying to send an empty message

deep musk
#

On

#

Oh*

lament rock
#

Send help

/channels/* and /guilds/* are the most paintful to update

plucky imp
#

ty

#

is that ts

#

jesus

lament rock
#

Yes. TS is beautiful compared to js

#

takes a lot of cues from C#, which I like

plucky imp
#

tbh

sudden geyser
plucky imp
#

i use sad js

sudden geyser
#

I've never seen import used like that

plucky imp
#

same

#

i use import for my dependacies and stuff

#

or if i'm pulling from a file

#

so many files open

dry imp
plucky imp
#

i should close them

#

shades of purple

dry imp
#

thx

lament rock
plucky imp
#

np

lament rock
#

not importing all the necessary members from my types package

plucky imp
#

it's a really good theme

#

i use a cool formatter so my code looks smooth and pretty lol

#

would recommend cascadia code btw

#

they have some pog symbols

sudden geyser
#

you should try synthwave

lament rock
#

synthwave is what I use

sudden geyser
#

same

#

only theme I like

lament rock
#

I used to use one called sweet

sudden geyser
#

just not its glow feature though

plucky imp
#

lol

sudden geyser
#

looks bad

plucky imp
#

i like the one i'm using currently

#

makes the colors more vibrant

#

yooo

#

wtf

#

@sudden geyser @lament rock this is lit

#

omg it goes well with my console too

#

the colors

#

my eyes

#

it's so pleasing

#

jesus

lament rock
sudden geyser
#

looks great, though I don't know why this is green

#

should be yellow

plucky imp
#

yeah

#

im using synthwave '84

lament rock
#

or I might just be looking in the wrong place

sudden geyser
#

the number doesn't seem to do anything for me

#

so bright

#

wait I can't turn it off now

#

okay now good

plucky imp
#

my vsc just updated

#

lol

#

this is pog

deep musk
quartz kindle
#

by not sending an empty message lol

lament rock
#

supply either content, embeds, or files

sudden geyser
#

Another theme I like is anything Xcode-based

deep musk
#

mm.hasPermission is not a function

neat ingot
#

I could never get into the neon effect for the synthwave84 theme. it looks awesome without it though! 🙂

deep musk
#

Is message.member.hasPermission still a function?

wheat mesa
#

you didn't give us any code to work with

wheat mesa
pale vessel
lament rock
#

overrides may not be what's desired

#

for instance, overrides can't have specific guild level permissions

rocky hearth
#

How to recognize closures in js

lament rock
#

define closures

proven lantern
rocky hearth
lament rock
proven lantern
#

cheater

lament rock
#

I know nothing of react so

pale vessel
lament rock
#

weird

#

Well. Not really weird, but if you want guild wide permissions, then getting overrides isn't helpful

#

idk why I like to argue about everything. I'll shut up

pale vessel
#

that's true, but i'd expect them to check if they could send messages, view channel, etc. and overwrites would be better to check with, while still being able to check kick members, manage server, and other guild-wide permissions

lament rock
#

That's theoretically the only way to check unless the everyone role or roles assigned to everyone have funky perms

lament rock
#

fr

warped venture
#

im trying to post my server count on my bot's top.gg page but i get this error (python)

code:
`from discord.ext import tasks
from discord.ext.commands import bot, Bot
import topgg

dbl_token = "my token"
bot.topggpy = topgg.DBLClient(bot, dbl_token)

@tasks.loop(minutes=30)
async def update_stats():
try:
await bot.topggpy.post_guild_count()
print(f"Posted server count ({bot.topggpy.guild_count})")
except Exception as e:
print(f"Failed to post server count\n{e.class.name}: {e}")

update_stats.start()`

error:
Traceback (most recent call last): File "C:\Users\---\Desktop\chat checker\server_count.py", line 6, in <module> bot.topggpy = topgg.DBLClient(bot, dbl_token) File "C:\Users\---\AppData\Local\Programs\Python\Python310\lib\site-packages\topgg\client.py", line 94, in __init__ self.loop = bot.loop AttributeError: module 'discord.ext.commands.bot' has no attribute 'loop'

can someone help

lament rock
#

module 'discord.ext.commands.bot' has no attribute 'loop'

warped venture
#

and it said "bot" was not defiened

#

so i added "from discord.ext.commands import bot, Bot"

lament rock
#

pretty sure bot is supposed to be an instance of Bot

#

aka your actual client

warped venture
#

so how can i fix it?

#

sorry if i seem dumb i have just started doing this stuff

lament rock
#

if you already have a reference of your bot from d.py, replace bot with whatever you named your reference
and make sure that it's defined before the code you posted
and replace import bot, Bot with just import Bot

warped venture
#

ok thanks

fickle arch
#

where do I start if I'm planning to make rpg bot

#

that one looks more challenging than my previous project

tulip ledge
#

Lets say you make something that handles fights

#

Make it so it can also handle fights in other commands and not just ur fight command

#

This is what burnt me out

fickle arch
#

I mean like where to begin with before making those fight/buy/etc function

dry imp
#

begin with currency

#

and pick a theme

fickle arch
dry imp
#

any basically

#

monster/scifi/human kinda thing

#

its a wide topic so u gotta figure the theme first

fickle arch
#

ahhh

fickle arch
#

uh, how do I make bot detect mute role, because on my case it require the server owner/admin to make "muted" role for the mute role to work

hybrid cargo
#

If there is none, create. If there is use it.
A better approach in my opinion would be to save the muted role ID to database so that it could be renamed and still be used as the default mute role

fickle arch
#

uh mind make it simple to understand, I'm still kinda new on developing

#

would this work

boreal iron
#

That will end up the role having no permissions

#

If everyone has the permission to talk this will do nothing

#

Then permission overwrites are your only choice

fickle arch
#

oh right, the mute role does nothing

fickle arch
#

am I doing it right

pale vessel
#

for the love of god use timeouts please

civic scroll
fickle arch
pale vessel
#

i didn't mean it in a bad way, but using overwrites is jank

rose warren
#

I'm actually surprised how many of my users have adopted slash commands 👀 This is slash commands vs message commands over the last 30 days. I only pushed the slash command update about 30 days ago so this is pretty much the adoption rate after 30 days of them being available.

sick agate
#

lol

rose warren
#

Over the last 7 days it's actually 30% slash

#

So it's slowly growing I guess

split hazel
#

yeah because discord is forcing people and encouraging to use them via the ui

earnest phoenix
#

Hello guys can they help me?

rose warren
#

Well they still have the choice of using message commands so I wouldn't say they're being forced

#

In my case

#

But I guess maybe people are having to adopt slash commands on other bots

split hazel
#

discord said they'll remove them so it is kind of forced, they might as well adapt now

rose warren
#

So probably just easier than remembering prefixes

split hazel
#

and discord even said they're going to be encouraging the usage of slash commands through ui messages and tips

rose warren
split hazel
#

unless you have that of course

#

bit inconsistent though

#

If you have it you can keep message commands but you can't get the intent for the sole purpose of message commands

rose warren
#

Yeah

#

I'd rather move 100% slash seeing what features might be coming in the future

split hazel
#

slash commands really raised the entry requirements for a discord bot

#

unless you want to be capped at 100 servers

#

the annoying part is setting them up but after you do that it should be fine

boreal iron
#

Which also sorts out at least some trash of people being made who shouldn’t even use a PC

unkempt cloak
#

how can i make direct vote cmd if user don't want to vist topgg website so he can direct vote bot using cmd

quartz kindle
#

you cant

unkempt cloak
quartz kindle
#

you can, but thats against the rules of most things

#

the user will be annoyed

unkempt cloak
#

yes rip

fickle arch
#

I'm making a dashboard for my bot, how do I make the dashboard automatically update the server count that the bot in ?

quartz kindle
#

while the page is open, or after refreshing the page?

fickle arch
#

so like first open bot in like 5 server, then after some time and open the same page the count updated to 7

quartz kindle
#

3 options:

  • run the server inside your bot file and get the count from the bot
  • run an ipc connection between the server and the bot so they can communicate
  • store the server count in a database and have the server access the same database
sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

@sage bobcat

crystal wigeon
#

anyone
used nextjs?
for some reason when i use axios in getServerSideProps im getting connection refused error
but when i run the same api in useEffect it works fine

ancient nova
#

does anyone know how to anchor a 2D object to the bottom left using canvas?

quartz kindle
#

wdym?

#

anchor in what way?

ancient nova
quartz kindle
#

just set its x and y coordinates to the same as the canvas's width and height

ancient nova
#

this is what I got, but instead of bottom left it spawns at the bottom center

#

perhaps anchoredPosition is responsible for that

#

but how do I know what to put there?

#

Vector2.left?

quartz kindle
#

idk how that canvas implementation works, but the idea is to set the object's position to x = canvas width - object width and y = canvas height - object height

ancient nova
#

so something like this then:

float xPos = canvas.transform.position.x - StaminaMeterBG.transform.position.x;
float yPos = canvas.transform.position.y - StaminaMeterBG.transform.position.y;
StaminaMeterBG.rectTransform.anchoredPosition = new Vector2(xPos, 15 + yPos);

@quartz kindle

cinder patio
#

err you can use the Unity UI to anchor it

ancient nova
#

it's instantiated on startup so can't

cinder patio
#

How is that stopping u

ancient nova
#

there is no way to do that using script, it's an option available only in the unity editor as far as I'm aware

boreal iron
#

Question for native English dudes
This profile name is already been taken or
This profile name is already being taken

ancient nova
#

no need for been or being

#

but

#

you can do

#

this profile has already been taken

boreal iron
#

that sounds weird

ancient nova
#

I'm not even native and it sounds okay for me

cinder patio
ancient nova
#

just treat me as native since I know pretty much the entire language

cinder patio
boreal iron
#

hmm guess I will end up with This profile name is already taken

#

sounds like the best option imo

ancient nova
#

sure

#

so @cinder patio you were saying?

boreal iron
#

ty anyways

ancient nova
cinder patio
#

I haven't used Unity in a while but I'm pretty sure nothing's stopping you from anchoring via the Unity editor, it doesn't matter when the object is actually instantiated.

ancient nova
cinder patio
#

Simply hide it

#

then show it when you need to

#

Are you instantiating it once

ancient nova
#

there is no code to anchor it on runtime besides doing math to tell it where to anchor

ancient nova
#

anchoredPosition takes care of that and it needs math input

#

there isn't something like

#

anchoredPosition.bottomLeft

#

I think at least

cinder patio
#

then anchor it via the editor and just make it hidden, show it when you want to

#

you don't need to anchor it dynamically

ancient nova
#

the object is not available in the unity editor unless the person presses play, if that makes sense

#

it spawns during the Start() method

cinder patio
#

you can instead create a single instance with the UI, then just hide it. The user won't be able to see it it'll be as if it's not instantiated.

#

show it when you need to

#

with code

ancient nova
#

don't get me wrong I already have that system implemented, but why

cinder patio
#

...because that's the cleanest and most obvious solution? Why create a single instance on startup when you can create it in the editor and just hide it? That's one of the most common ways to spawn things in unity

ancient nova
#

you jsut create the gameobject and referencing it

#

as someone said before, it's lazy

cinder patio
#

It's literally one of the most common ways to do this, lmao. It's not lazy.

ancient nova
#

it's every beginner that does that

#

should I just anchor the x position to like -100 and get it over with

cinder patio
#

... there's literally no downsides to doing it like this.

#

It's not bad

#

it's good

#

it's simple

#

it's readable

#

You only need one instance

#

If you needed more then yes

ancient nova
#

I don't even need an instance

#

just reference the variable in the script

#

but still

cinder patio
#

then it's EVEN better

#

you can use the UI and just drag and drop it to the scripts that need it

#

literally the UI is made for this

#

you're arguing against the UI

ancient nova
#

I know, but I already draw it during the execution of the script, I've made it compact enough for everything to spawn during runtime

#

why would I destroy that

cinder patio
#

why are you drawing it during runtime anyways 🤔 Is the sprite dynamic or not

#

If it's not then just load in an image

#

hell even if it's dynamic you can only draw the dynamic parts in

#

you can still use the UI

#

you can draw it in it's Start() function

earnest phoenix
#

can fs do something like this? ```json

{
"userID": "",
"gold": 0
}
with fsjson
{
"userID": "2020020102",
"gold": 0
}

boreal iron
#

well you parse the JSON string, edit it, then stringify it again

#

and write the file contents

#

going with a regex to find and replace the line is... possible but errr

earnest phoenix
#

🤯

#

ok

ancient nova
#

it's supposed to be a stamina meter

#

drawing it on the screen during runtime is simply for making the script compact

#

just paste the script and you got everything working, no need to do much in order to make it work

ancient nova
#

good thing Unity doesn't have regex or I'll be using that there too

#

bruh @cinder patio looks like putting the anchor to vector3.left * some value made it work

#

and it automatically scales with the screen too

cinder patio
#

no clue why you'd want to make a sprite "compact" by drawing it with code instead of just having it on disk as an image... but ok

#

like you're using it once

fickle arch
#

uh how do I use safe filter for some search api

quartz kindle
#

check the docs of some search api to see if they have one and how to use it

ancient nova
#

bro this new project is gonna be so much better

#

I've done more in this couple hours than I've done in a couple days in the old project now that I 100% know what I want to do

#

does anyone know where to find very high quality textures?

earnest phoenix
#

Hello guys i have a problem in my discord bot

#

Can they help me?

quartz kindle
#

they who?

earnest phoenix
#

Is a crash

worn grotto
#

Hey

sudden geyser
#

@sly sierra question about neovim

#

do you prefer to use init.vim or init.lua

ancient nova
#

I wish I could enable ray tracing with this, the volumetrics work well with these types of light

sly sierra
#

Though I don't find a difference, whatever your comfortable with

#

Lua file is more straight to the point

earnest phoenix
#

so .setFooter('string') is deprecated in v13 and we need to use .setFooter({ text: 'string' })?

earnest phoenix
fickle arch
#

uh, where do I see tutorial to make a interactable dashboard like the one mee6 have, already made one but it's not interactable.

sacred cypress
#

Interactable dashboard?

#

Just a web-panel that changes a few settings here and there that then the bot applies to a specific server it's in?

copper cradle
#

for some reason whenever I use the autocomplete feature of nvim cmp, and try to edit a new file, like 5 empty buffers open along with it

#

wut

ancient nova
#

does anyone want to take a look at my code and optimize it? it's c# tho

sudden geyser
#

bruh I can't even figure out how to switch views

ancient nova
#

take it as a challenge cause it's really really really bad

sudden geyser
#

it's c# tho
SumiCringe

ancient nova
#

it's a good language

#

and not cringe

#

and am definitely not asking for someone to improve it cause I can't do it myself

sacred cypress
#

@ancient nova its on git?

carmine summit
#

HTTPError [AbortError]: The user aborted a request. what is this?

austere surge
#

the user aborted a request

sudden geyser
#

means some http request got canceled

#

probably discord.js

carmine summit
#

it IS discord.js

sudden geyser
#

is it happening in some section of your code / some area you know about

#

and if so does that task run for a while

quartz kindle
#

djs aborts if it takes longer than 15s

sudden geyser
#

because aborts usually happen when a request from the library to discord is taking a while (15 seconds), which could be influenced by rate limits

lament rock
#

or your network just sucks

austere surge
#

true...

low moat
#
const discord = require("discord.js")
const { MessageButton, MessageActionRow, MessageMenuOption, MessageMenu } = require("discord-buttons")

        module.exports = {
            name: "Pheonixia",
            aliases: ['pheonixia', 'Pheonixia'],
            usage: "pheonixia",
            description: "shows country stats",
            run: async (client, message, args) => {

                const Factory1 = new MessageMenuOption()
                .setLabel("Factories")
                .setDescription("Manage your Factories")
                .setEmoji(":factory:")
                .setValue('factory')
                
                const Menu = new MessageMenu()
                .setID('menu1')
                .setPlaceholder('Manage Information')
                .addOption(Factory1)
                .setMaxValues(1)
                
                const TedoaMesajGönder = new MessageActionRow()
                .addComponent(Menu)
                
                await message.channel.send("Democratic Republic of Pheonixia", { components: [TedoaMesajGönder] })
            }
                
        }```

Basically I have been trying to create menu option and I am VERY new to the idea of these drop down menus as well as buttons but this is what I have at the moment, it is causing me issues for some odd reason as cmd prompt keeps telling me that MessageMenuOption is not a constructor? 💀
restive barn
#

Who a bot dev that code discord.js? I need help with afk command lol

pallid zinc
wheat mesa
lament rock
#

iirc there are no discord.js devs here 👀

dry imp
restive barn
wheat mesa
#

ask your question

restive barn
#

Wait

#

so no discord.js :(

#

I feel lonely

wheat mesa
#

No he's joking

#

There are plenty of djs users here

#

Just ask your question instead of asking to ask

dry imp
austere surge
low moat
#

oh and my code is like this now

restive barn
#

Does anyone know how to code a afk command? I try looking for one or try coding myself but It not working

-discord.js v12
-new to coding lol

quartz kindle
#

what is an afk command lol

restive barn
#

Bruh

wheat mesa
#

Nobody here is going to write your command for you. You need to ask a more specific question than that

restive barn
#

Jk

#

Oh okay

austere surge
restive barn
#

Not pointless but okay

pallid zinc
austere surge
#

quite is

#

just go do not disturb

#

or say it yourself

pallid zinc
#
let menu = new MessageActionRow()
.addComponents(
    new MessageSelectMenu()
)
quartz kindle
low moat
quartz kindle
#

thats the problem

pallid zinc
#

u need 13

low moat
#

oh lordy lord when does it stop lmao okay hold on i will give it a go

quartz kindle
pallid zinc
#

ig u want people to set there afk message

low moat
#

anddd here we go again, I actually had this issue earlier but managed to fix it with
const client = new Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })
still no idea what it means since i suck at reading errors

pallid zinc
#

when someone run the command he/she saves them message

restive barn
austere surge
pallid zinc
#

and when someone ping him/her they tells that message

austere surge
lyric mountain
quartz kindle
restive barn
#

Yes

restive barn
#

I know

lyric mountain
#

So in that error, you read the first and the third lines

#

Valid intents weren't provided to the client

low moat
quartz kindle
fickle arch
#

uh question regarding sharding / clustering what is those and when to use it ?

austere surge
earnest phoenix
#

"afk" command developers when they discover the "idle" Discord user status

quartz kindle
#

each connection can only handle 2500 guilds

wheat mesa
#

I feel like afk commands are just people trying to pack more features into their bot

quartz kindle
#

so you need to shard when you get close to that

lyric mountain
austere surge
#

isnt clustering using multiple devices or whatever to share the load across them

fickle arch
quartz kindle
low moat
earnest phoenix
quartz kindle
#

for example, if your bot has 5000 guilds total, you will usually have 5 shards with 1k guilds each

#

you could also have 2 shards with 2,5k each, but its recommended to have 1000-1500 per shard

lyric mountain
pallid zinc
#

what if one of my shards went off will it effect others? 👀 😂

lyric mountain
#

Read the documentation to see if you didn't forget anything

fickle arch
pallid zinc
#

👉 👈

quartz kindle
#

sharding gives you the ability to load balance your bot, which can be done in many different ways

#

if you run each shard in a separate process for example, they will be completely isolated and independent of each other, and cannot affect each other

#

if one dies, the others will not be affected

low moat
fickle arch
#

also how you set shard

pallid zinc
#

btw, i remember the time when people run there code 2 times in terminal and ask why its responding 2 times, will sharding solve this?

quartz kindle
#

but you can also run multiple shards within the same process, or use worker threads for example

quartz kindle
quartz kindle
fickle arch
lyric mountain
#

At least show the part where the error happens

pallid zinc
quartz kindle
#

discord.js supports 2 different sharding methods, "internal sharding" and the "sharding manager"

fickle arch
#

what's the common used

rocky hearth
#

which is the react's latest version?
18.0.0-rc.3 or 18.0.0

quartz kindle
#

internal sharding means your bot will create multiple shards all inside the same process, there is no difference in code, everything works exactly the same. you enable it by setting shards: "auto" in your Client options

lyric mountain
#

Rc means "release candidate"

low moat
# lyric mountain At least show the part where the error happens

"TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client."
i think its in my main file which would be bot.js


const discord = require('discord.js');
const fs = require('fs');
const client = new discord.Client();
const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');
require("discord-buttons")(client);

client.commands = new discord.Collection();
client.aliases = new discord.Collection();
client.queue = new Map();

console.log(`Loaded Nonay Database`)
console.log(`Loaded Nonay Music`)
console.log(`v1.2.1 - Nonay Bot`)

const Categories = ["misc"]; //Commands => Category => Command

Categories.forEach(async function(Category) { //
    fs.readdir(`../jbot/commands/${Category}`, async function(error, files) {
      if (error) throw new Error(`Error In Command - Command Handler\n${error}`);
      files.forEach(async function(file) {
        if (!file.endsWith(".js")) throw new Error(`A File Does Not End With .js - Command Handler!`);
        let command = require(__dirname + `/../commands/${Category}/${file}`);
        if (!command.name || !command.aliases) throw new Error(`No Command Name & Command Aliases In A File - Command Handler!`);
        if (command.name) client.commands.set(command.name, command);
        if (command.aliases) command.aliases.forEach(aliase => client.aliases.set(aliase, command.name));
        if (command.aliases.length === 0) command.aliases = null;
      });
    });
});```
lyric mountain
#

So it's kinda a "pre-release" version

sage bobcat
quartz kindle
#

the sharding manager needs additional configuration, you need to create a new ShardingManager instance in a separate file, that will manage multiple instances of your main bot file, each in a separate process

rocky hearth
earnest phoenix
lyric mountain
fickle arch
quartz kindle
#

you didnt define intents there

sage bobcat
#

One message removed from a suspended account.

lyric mountain
#

Timotei

quartz kindle
#

@sage bobcatfthie

sharp geyser
rocky hearth
sage bobcat
#

One message removed from a suspended account.

earnest phoenix
rocky hearth
#

ok

quartz kindle
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

its not fake

lyric mountain
quartz kindle
#

just not the english variant

sharp geyser
#

tim faking?

quartz kindle
#

it doesnt have "th"

lyric mountain
#

So yes, misty is right

sharp geyser
#

smh

low moat
# quartz kindle

you two are great ty so much but now its back again and with a new error, this time i legit do not have a donkeys clue what it is saying
I also changed the code accordingly:

const fs = require('fs');
const client = new discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })
const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');
require("discord-buttons")(client);
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

Oh god... Not discord-buttons

sharp geyser
#

Also what version of djs are you using?

sage bobcat
quartz kindle
sharp geyser
#

You can do buttons without the discord buttons package if you are on v13

quartz kindle
#

lmao

sage bobcat
#

One message removed from a suspended account.

low moat
lyric mountain
quartz kindle
# low moat ah alright let me just uninstall it real quick

also, just fyi: ```js
const discord = require('discord.js');
const client = new discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })

is exactly the same as

const { Client } = require('discord.js');
const client = new Client({ intents: ["GUILDS", "GUILD_MESSAGES"] })

you dont need both, just pick one style

earnest phoenix
#

Gotta love how discord.js users flood the support server with "where X feature???" As soon as it comes out, as if it's gonna be implemented in a minute

sage bobcat
quartz kindle
#

yesh

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

slavic

#

:^)

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

i grew up in portugal, but im slovenian

lyric mountain
#

Found it

quartz kindle
#

lmao

#

not agaoin

earnest phoenix
#

Timotei

sudden geyser
#

is that meant to be spoken like demote

quartz kindle
low moat
# quartz kindle also, just fyi: ```js const discord = require('discord.js'); const client = new ...

ty for this, the errors havent given up yet tho lmao. I have never had this issue before though, going to guess i touched something i shouldnt of touched or maybe its the new discord.js version?


  let Prefix = config.prefix

  if (message.author.bot || !message.guild || message.webhookID) return;

  if (!message.content.startsWith(Prefix)) return;

  let args = message.content.slice(Prefix.length).trim().split(/ +/g);
  let cmd = args.shift().toLowerCase();

  let command = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd));

  if (!command) return console.log(`No Command Found!`);



  if (command) {
    command.run(client, message, args);
  };
});```
#

no. i. am disappointed

earnest phoenix
quartz kindle
#

remember both styles?

low moat
lyric mountain
quartz kindle
#

you can either do const config = require('./config.json'); and then use config.prefix
or
you can do const { token, prefix } = require('./config.json'); and then use prefix directly

sharp geyser
#

I love Microsoft's C# documentation

lyric mountain
#

Konata acts like the ad lady cleaning her hair

sharp geyser
#

Especially their ASP docs

quartz kindle
#

for some reason my code was taking 20ms instead of 1ms, turns out the problem was ```js
if(date.toString() === "Invalid Date")

low moat
quartz kindle
#
const { somethingElse } = require("something");

is the same as:

const something = require("something");
const somethingElse = something.somethingElse;
sharp geyser
#

One assigns everything to a variable the other grabs that prop directly from the file

#

this is my understanding at least there could be more technical stuff happening but 🤷

pallid zinc
sharp geyser
quartz kindle
#

lmao

low moat
sharp geyser
#

they already have a prefix defined in a json file

pallid zinc
#

Ig he new and is unable to do that

#

Make things easier

sharp geyser
#

seems like you're new and don't understand the value of having a file with all your config stuff separate from the actual code base

sharp geyser
#

the way he is doing it is perfectly fine he just seems to not understand how to grab the prop from the file without mixing two styles of doing so (from my understanding of the conversation this is what he is doing I might be wrong tho sorry if I am)

pallid zinc
#

You are right

quartz kindle
#

you are left

pallid zinc
#

👀

sharp geyser
#

:)

quartz kindle
#

:^)

sharp geyser
#

rick roll

#

the one meme that wont die out even when it reaches 2050

#

that and your mom jokes

earnest phoenix
#

You've forgotten about amogus memes

sharp geyser
#

Those have already somewhat died out

#

now only losers use em

sharp geyser
earnest phoenix
#

They're coming back with a strong hit again, they'll never really die out

sharp geyser
#

and my pc handles them poorly

earnest phoenix
#

What games

sharp geyser
#

Got em both for a little over 25$

#

Dead by Daylight, and Horizon Zero Dawn

earnest phoenix
#

Horizon Zero Dawn is awesome

sharp geyser
#

ikr

#

Tho my pc handles the animation and audio poorly

#

Neither are linked up right

#

The audio is like 5s ahead

#

so I kind of know what is happening before it actually happens

low moat
sharp geyser
#

Not benefit

#

because it looks bad

#

I want the animation to sync with the audio

unkempt ocean
#

what you guys think about interaction localizations?

sharp geyser
#

if my pc was a bit better the game experience would be 10x better as well

sudden geyser
#

have you tried sleeping and tackling the problem later

earnest phoenix
quartz kindle
sharp geyser
#

Donate to my onlyfans paypal

#

:)

quartz kindle
#

unless you screwed up and created a new error instead

earnest phoenix
#

🤨

sharp geyser
#

I just need to get a project that can make me some money going

#

Then i'd be set

#

ezpz

sudden geyser
low moat
unkempt ocean
sharp geyser
quartz kindle
sharp geyser
#

you probably swapped it to const { Client } = require('discord.js') so you can just do new Client()

sharp geyser
#

I just didn't pay for em

#

:^)

#

too expensive for a puzzle game

earnest phoenix
#

Eh, considering how clever and satisfying the puzzles are, I would say otherwise

sharp geyser
#

I am not a big puzzle guy

low moat
sharp geyser
#

so not willing to spend 10$ for them

#

well

quartz kindle
#

you didnt understand what we are saying

sharp geyser
#

one you are doing something you shouldn't

quartz kindle
#

look

sharp geyser
#

when destructuring you dont need to do it multiple times

low moat
#

no i really dont i am so tired it is really late

sharp geyser
#

you can group of Intents and Client together in one destructure

#

and just do const client = new Client(...)

earnest phoenix
#

Coke, I'm gonna be honest, instead of wasting time; take a break and resolve it later, by this you'll just make it worse

quartz kindle
#
const { Intents, discord } = require('discord.js');

is the same as 

const discord = require('discord.js');
const Intents = discord.Intents;
const discord = discord.discord;
``` you see whats wrong there?
#

there is no discord.discord

feral aspen
#

Is it possible to define a variable and use the destructuring assignment on the same require method?

quartz kindle
low moat
dry imp
#

bruh

quartz kindle
sharp geyser
#
const { Client } = require('discord.js')
const { Intents, discord } = require('discord.js');
can be changed to
const { Client, Intents } = require('discord.js')

When destructuring you don't need to do it multiple times if it is coming from the same place. You can just do it all at once

sharp geyser
quartz kindle
#
this is an object:

const myObject = {
  a: 10,
  b: 20
};

you can access the values like this:

myObject.a // 10
myObject.b // 20
earnest phoenix
#

Explaining it like that is mostly a waste of time, just link it to the MDN docs :^)

sharp geyser
#

Is there any performance or any other difference between destructuring an object to just assigning it as a variable and doing it that way?

sharp geyser
#

So it is just a preference

quartz kindle
#

ye

sharp geyser
#

icic

#

destructuring does look cleaner tho ngl

low moat
quartz kindle
#

thats just because you're trying to code blindly, its the same as trying to write an essay in a foreign language that you didnt study

#

try to learn some javascript basics and you'll have a much easier time

low moat
feral aspen
#

There are many other resources, but if you want to learn slowly and not about something specifically, you can use FreeCodeCamp.

low moat
feral aspen
#

You can't code without learning.

earnest phoenix
feral aspen
#

If you want to learn about something specifically (supposedly more information about commenting), it's at any of the link above or at https://developer.mozilla.org/en-US/.

The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.

low moat
#

i feel teased and dead i feel like my about me needs to be changed

#

ty i am gone now goodbye friends

sharp geyser
#

How is that wrong?

rose warren
#

Tim is never wrong tlcWholesomeShiba

sharp geyser
#

yes

earnest phoenix
austere surge
#

what are you trying to do?

#

and is that a bot or a user account

slender thistle
slender thistle
wheat mesa
# earnest phoenix Help

Your account needs 2fa in order for your bot to perform moderation actions in community/large discords

fickle arch
#

I tried to put my new bot token into old code and it ended up like this

#

but when I put old bot token, it could

earnest phoenix
fickle arch
#

so I need to activate it on the bot dev portal ?

#

ah ok, thanks

earnest phoenix
#

Yes

#

Or remove it from your code if you dont need it

hollow depot
#

can anyone help me on this?

its an electron app built with html, css and js, when i click on the togglebox the opacity and mix-blend-mode of other stuff seem to do what they want, idk how to solve

#

if it matters, the togglebox when checked does a translateX(26px)

earnest phoenix
#

My work so far anyway, basically wrote a highly stable framework just gotta finish two things up and tags I think

#

Then need to write the api protocols but shouldn't be crazy hard, anyone here full stack?

boreal iron
#

Dude that’s no platform to find developers working for you

earnest phoenix
#

Huh?

#

Oh my bad

boreal iron
#

You should also consider to learn how to do screenshots without weird angels to let it at least look professional

earnest phoenix
#

Nah bro don't wanna expose too much infront of 300k

boreal iron
#

Hmm that’s why cutting, markers and filters exist even in the simplest tools

earnest phoenix
#

R u full stack

boreal iron
#

But anyways you might wanna use an online platform to find developers

earnest phoenix
#

Yeah

boreal iron
#

I literally haven’t time to deal with my own shit

#

lol

earnest phoenix
#

True yeah lol what do u work on

slender thistle
#

Not driving into trees hopefully

dry imp
#

tru

slender thistle
#

driving into trees while texting*

dry imp
#

truer

earnest phoenix
#

Huh where did everyone come from

slender thistle
#

Out of my cave due to boredom

boreal iron
#

Once days have 72h I will have some time left

#

I do atm

earnest phoenix
#

Oh true yeah

#

You working on something big

boreal iron
#

And I’m going to leave the highway.. see ya later

earnest phoenix
#

Bet

boreal iron
earnest phoenix
#

What's that

boreal iron
#

Nothing commercial

earnest phoenix
#

Oh

#

Mines commercial

lament rock
#

I've been working on a pretty low level abstraction layer for Discord rest and supporting X-Audit-Log-Reason and multipart/form-data in every edge case is hard.

Like for reason, I could assign a reason property to JSON params for payloads, but that doesn't work for where the API only accepts Arrays since Array.reason doesn't exist and I can't just arbitrarily assign object properties since Discord can and will change often.

The lib manages multipart files for the user and having cases where they have to manage it would be super inconvenient

#

copium I guess. Low level Discord dev work sucks

#

If anyone has an elegant solution for my issues, I'd love to hear

pale vessel
#

they're getting rid of the audit log header soon iirc

lament rock
#

fr?

#

replacing it with what?

#

or are audit logs just gonna go bye

fickle arch
#

how do I update node version on replit

#

eh nvm figured it out

pale vessel
split hazel
fickle arch
#

so I'm on hosting test trial for my project and hosting it on heroku before I deploy it to vps, I got canvas.node: invalid ELF header, I tried to use gitignore but it doesn't work

lyric mountain
#

gitignore is just for ignoring files during commit

#

as it seems, you pushed your node_modules folder to git

#

which broke heroku

fickle arch
#

yeh I can see that, which make some of my command doesn't work either

#

how do I fix it

lyric mountain
#

I'm more amazed by HOW you managed to push node_modules

fickle arch
lyric mountain
#

still, the modules folder is huge, it should've taken a long time to commit it

#

nonetheless, you need to delete it somehow

fickle arch
#

you mean delete it from the repo ?

lyric mountain
#

yes

fickle arch
#

so heroku will install it ?

lyric mountain
#

but do it locally, since u cant delete a folder on github without deleting all files within it

fickle arch
#

yeh, then push it to github

lyric mountain
#

yes

#

the drawback is that you'll still have the folder on ur history

fickle arch
#

alright then, I'll try it, thanks for the help

lyric mountain
#

making future pulls slower

#

I'd just delete the repo and create another

sudden geyser
#

bad idea

lyric mountain
#

for the history you mean?

sudden geyser
#

ye

lyric mountain
#

well, rebase it then

fickle arch
#

do I need to do the same if I using vps or no

fickle arch
lyric mountain
#

yw

raw sigil
#

i create this command and if i use this command bot send this message

quartz kindle
#

according to the distube docs, name is not guaranteed to always exist (notice the question mark)

wheat mesa
#

Damn Tim going out of his way to check third party library documentation for this man

earnest phoenix
#

😋

low moat
fickle arch
#

is it more complicated if I built dashboard inside my bot project, or it's more simple to separately making it, I want the dashboard can be use to configure the bot.

wheat mesa
#

Personally I would build them separately and use either IPC or websockets to communicate between the two

quartz kindle
#

its easier to put it inside the bot, but if the bot is offline, the website is also offline

fickle arch
#

uh how do I make space between each section on html

sudden geyser
#

<br>?

#

css?

fickle arch
sudden geyser
#

As for your previous question, like Tim said, it's easier, but you couple your bot to your website. While they are connected, they aren't strictly connected, so keeping the website and bot in separate projects is a better design imo.

quartz kindle
#

i would do it the database way, keep both separate, and both access the same database

fickle arch
#

but how do I make the website interact with the bot, for example I have a function to enable/disable xp system on the website, and want the bot to do the same.

sudden geyser
#

Now what if the database goes out

quartz kindle
#

the next time the bot checks the database, it will already be updated

sudden geyser
fickle arch
#

so connect both the website and the bot to the same database

#

alright then, thanks

raw sigil
#

what if they use any music package and they get to the bot check and make the request.
Will the bot be accepted or rejected or removed?

fickle arch
#

what color that could match the header background and the body

quartz kindle
#

the blue is horrible, the white looks good

fickle arch
#

trying both white and grey

split hazel
#

red is a risky choice

#

go with idk something lighter

solemn vigil
#

anyone able to help me grow community?

#

or help with community

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

i have no idea what that even means

wooden ember
#

does anyone here know about gnu screen? cuz on my old server i had a shell script that ran on boot. it started my node apps and mc server and it all worked fine. everything ran in its own screen session using a command like screen -dmS <session name> node index.js and it all worked but in ubuntu it will not work
-i have varified the script runs but making it beep the bios buzzer
-screen its self works
-the script runs perfectly if i run it manually
what elce is there?
i knwo this is probably wayyyy out of the scope of this server but just asking out of curiosity since its a verry obscure problem and i have no idea how to google it lol

#

i hate updating shit always makes more problems than its worth

austere surge
#

ive never used screen

lyric mountain
#

ubuntu 20.x

#

never had issues with it at all

#

I'm a bit confused with what -dmS does, I always created a screen and ran whatever I needed from inside it

wooden ember
#

-d means start detached
-m idk tbh
-S is the flag that makes the screen nameable

#

so together its -dmS

lyric mountain
#

I always used permanent screens

wooden ember
#

you only need it really if you want to automate stuff which is my intentions

lyric mountain
#

what exactly is the error you're encountering?

#

couldn't it be permission issues?

wooden ember
#

it only happens when the script is run on boot and its run as root

#

if i run it manually it works fine no errors

#

and when it runs on boot it doesnt log anything

#

worked perfectly on centos 7, read some where it might be becuase it have to be run as a service but i cant find ant info to back that up

#

also what do you mean "perminant screens?"

lyric mountain
#

screen

#

it creates a new screen that u can access with screen -r name

#

then inside it I do whatever I want to do

#

u can rename permanent screen with :sessionname name

wooden ember
#

thats just a normal screen isnt it?

lyric mountain
#

ye

wooden ember
#

fair

#

i want to do that but automatically on boot

fickle arch
#

how do I make new page on html

quartz kindle
#

wdym a new page

austere surge
wooden ember
#

?

#

oh i see

austere surge
#

the

wooden ember
#

i need to wait for the network first

#

so i have a shell script that does all that

austere surge
#

a bit slower boot but youll get network

wooden ember
#

mmmm

#

sound like reinventing the wheel

#

i just want to know why screen inst running

#

its all setup exactly the same as on my old server but its just not working

austere surge
#

i also wnt to know why docker networking is so confusing

wooden ember
#

lol

wooden ember
#

bruh

#

i want my centos minimal box back

fickle arch
#

I tried use fas-server icon it work for a while on my html, then after 5 minute the icon is gone but the code still there, tried to refresh and still the same results.

simple stump
#

I hate CSS. Any suggestions on how to make this look half decent lmao (making a “website” for a friend)

austere surge
#

that looks good wdym

#

the big black square is a bit weird but eh

woeful pike
simple stump
#

Thanks for your input! I'll keep that in mind 👍

woeful pike
opaque acorn
#

in djs v13's slash commands message is replaced with interaction?

boreal iron
#

No

#

The interaction object comes with its own properties and not all properties you know from message objects are available for interactions

split hazel
#

maybe

boreal iron
#

That’s the base where different types of interactions have some more or less properties available

lament rock
#

Messages will continue to exist

#

just most bots will not be able to access their content

boreal iron
#

Or attachments, embeds etc.

rocky hearth
#

How do I make .gitignore to ignore a specific folder.
Read that again: I don't want to ignore a folder by git

#

I want to have a folder that is not affected by .gitignore

winter pasture
#

So:
*.exe #Exclude all exe
!foo.exe #Except for foo.exe

keen harbor
#

Hello, do you guys know a bot that can make tasks for members such as following a twitter account?

pale vessel
#

you could integrate Twitter authorization within the bot and it could follow users for a Twitter user if received proper scopes

#

i'm not sure if there's already existing bots that could do that

lyric mountain
earnest phoenix
#

i get a weird ass error

#

lemme send rw

#

rq

lyric mountain
earnest phoenix
#

please

#

RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.

#

uhh

#
                    {
                        name: `> Roles [ ${ roles?.length ?? "0" } ]`,
                        value: `${ roles ? roles?.join(", ") : "No roles." }`,
                        inline: false
                    },``` Error is probably here
#

or

#
            let roles: any = user?.roles.cache
                 .sort((a: Role, b: Role) => b.position - a.position)
                 .map((role: Role) => role.toString())
                 .slice(0, - 1);```
lyric mountain
#

if you're using ?. it means it's a possibly-null value

#

check for user existence before entering that block

quartz kindle
#

that should still give "undefined" as a string tho

lyric mountain
#

that's the only field where there isn't any sort of fallback value or md character tho

earnest phoenix
lyric mountain
#

don't use ?. then

earnest phoenix
earnest phoenix
lyric mountain
#

no

#

that doesn't even exist

#

it's because of this that the linter is warning you

#

you declared it might be null or undefined

quartz kindle
#

thats correct tho

#

the user is indeed nullable

lyric mountain
#

does adding a guard make the linter stop warning?

quartz kindle
#

hes using typesxcript

#

so yes

lyric mountain
#

add a guard then

pale vessel
#

if u know it exists just put !.

earnest phoenix
#

nevermind

#

i got it

earnest phoenix
lyric mountain
pale vessel
#

yeah

quartz kindle
#

in typescript yes

earnest phoenix
#

yes it is

quartz kindle
#

it overrides a nullable type

#

its kind of a stupid design tho

pale vessel
#

depends on the scope sometimes ts doesn't realize you already added a guard

quartz kindle
#

i see people using it wrong all the time then

#

lmao

lyric mountain
#

btw, this is wrong

#

it's like condition OR false

quartz kindle
#

yeah was going to mention that lmao

#

btw his actuall issue was probably coming from here

value: `${ roles ? roles?.join(", ") : "No roles." }`,
lyric mountain
#

ah

carmine magnet
#

roles.length then?

quartz kindle
#

ye

#

roles?.join(", ") || "No roles" should be enough tho

pale vessel
#

role?.join(", ") || "no roles"

#

empty string

earnest phoenix
#

ohhh

quartz kindle
#

except if roles can be anything other than array, then it will throw join is not a function lmao

pale vessel
#

join?.() Brainnnn

quartz kindle
#

xD

earnest phoenix
#

what the fuck

pale vessel
#

just add ?. to everything, surely that fixes everything

pale vessel
earnest phoenix
#

when i did ??, I got error... but when I did || the error got fixed

#

:kekwnou:

quartz kindle
#

because "" fails with || but not with ??

earnest phoenix
#

ohhh

#

it all makes sense

#

thank youuu

quartz kindle
#

btw why is there no null coalescing negation in js

#

i want to be able to do if(?value) {}

#

instead of if(!value) {}

woeful pike
#

my brain is hitting 100% cpu usage just looking at that code

woeful pike
#

seems really confusing

quartz kindle
#

get a better cpu

#

xD

woeful pike
sudden geyser
#

find einstein's brain

woeful pike
#

is that just supposed to be

if (value == null) {}
#

as in it's only either null or undefined

quartz kindle
#

everybody's running on ryzens these days, you cant keep up with a core2duo for brains much longer

earnest phoenix
#

bro come on

#

i was tryna find another way

#

it was neat recently KEKW

quartz kindle
#

rip the new generations tho, all running on arm

lyric mountain
#

I run on leg tf

quartz kindle
#

xD

hybrid cargo
#

I run on any kind of floor

stiff lynx
#

Sometimes when I cache for a channel I get this error, there is a way to avoid it?TypeError: canale.send is not a function at Client.<anonymous> (/root/novabotStable/events/guildMemberAdd.js:75:30)

lyric mountain
#

yes, add a guard

#

if (!canale) return; or something

wooden bobcat
#

or use try function

stiff lynx
stiff lynx
wheat mesa
#

If it’s a channel you’re grabbing from cache, then there’s always a chance that it’s not cached

#

Fetch it instead

#

If the channel is already in cache, djs will grab it from the cache for you

stiff lynx
#
function cercaCanale(client, id) {
    const canale = client.channels.fetch(id)
    if (!canale) {
        return null
    } else {
        return canale
    }
}```
#

like this?

wheat mesa
#

That is not how you use fetch

stiff lynx
#

loool

wheat mesa
#

Also you should probably consider returning null instead of false

carmine magnet
#

Fetch is a function

wheat mesa
#

client.channels.fetch(id)

#

Actually just return the channel itself, no need to check for null or false in the function unless you want to throw an error or something

#

Just check for null whenever you call that function

stiff lynx
#
function cercaCanale(client, id) {
    const canale = await client.channels.fetch(id)
    if (canale) {
        return canale
    }
}
wheat mesa
#

You also have to await fetching

#

And just return canale without a check for it

carmine magnet
#

And your function has to be asynchronous

wheat mesa
#

If it’s not found, it’ll be null

#

And then when you call that function, check for null on your result