#development

1 messages · Page 1812 of 1

nimble kiln
#

I believe I can send up to 10 in one message

crimson vapor
#

something like that

#

might make sense to create your own queue system

nimble kiln
#

yeah that's what I want to avoid 😄

crimson vapor
#

and only send messages every few seconds

nimble kiln
#

I was reliefed that discord doesnt hit my bot with global ratelimits when I hammer webhooks

crimson vapor
#

if you hit something like 50/s you will be tho

nimble kiln
#

oh rly? good to know

#

Well it's far below that, it may reach 5/s or something. Maybe 10/s at most (actually no, 10/s is way too much)

nimble kiln
#

Seems to have worked, ty for the tip 🙂

tired panther
#

How is this color?

boreal iron
#

better

#

but white on the dark background will look even better

lyric mountain
#

try some light gray

paper shard
#

ok

#

hhi

lyric mountain
#

also try white on the colored boxes or bold font

tired panther
cinder patio
#

Lighter green maybe

#

and remove that blue

lyric mountain
crimson vapor
#

unpopular opinion: you shouldn't need shard stats because they should never be offline (unless you use k8s or something)

paper shard
#

oh

tired panther
crimson vapor
#

unless you're using k8s or some custom client stuff you can't move shards to different machines

cinder patio
#

Bold of you to assume he doesn't have a custom setup

crimson vapor
#

not really that bold

#

its pretty uncommon

lyric mountain
#

but anyway, @tired panther, go bold white on colored boxes

#

black on those colors feel a bit...off

crimson vapor
#

@tired panther on your discord-cross-hosting, how are you sending evals? it doesn't seem as though you are requiring any IPs or anything
are you saving evals as documents in monogodb???

tired panther
crimson vapor
#

I mean if it works ¯_(ツ)_/¯

#

but

#

its really really stupid

#

its incredibly slow

lusty quest
#

just use websockets

crimson vapor
#

and there is no reason to use a database for that shit

cinder patio
#

tcp

#

is bettet than ws

#

better*

crimson vapor
#

websockets or an API would probably be the easiest to setup

tired panther
crimson vapor
#

what do you check the db every 25 ms or something?

tired panther
#

Mongodb fires the Events 👀

crimson vapor
#

ah

#

ig thats better than just checking all the time

#

its still yikes to do it that way

tired panther
cinder patio
#

tcp for the win

earnest phoenix
tired panther
jovial nexus
#

is there a way to track the UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access errors??

boreal iron
#

Yeah, just catching and handling them

chrome grail
boreal iron
#

I know... not needed to tell me

lament rock
#

its recommended to have a process.on("unhandledRejection" listener so that the frames of the errors are cleanly printed

smoky kestrel
#
const DB = require('../../../slappey.json')
const config = require('../../../slappey.json')
const prefix = require('../../../slappey.json')
// const PASS = require('../config');
// const DB = require();
module.exports = class LevelCommand extends BaseCommand {
  constructor() {
    super('level', 'levelingSystem', []);
  }

  async run(client, message) {
    if (!message.guild) return;
    if (message.author.bot) return;

    

    const args = message.content.slice(prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();

    const randomXp = Math.floor(Math.random() * 9) + 1; //Random amont of XP until the number you want + 1
    const hasLeveledUp = await Levels.appendXp(message.author.id, message.guild.id, randomXp);
    if (hasLeveledUp) {
        const user = await Levels.fetch(message.author.id, message.guild.id);
        message.channel.send(`You leveled up to ${user.level}! Keep it going!`);
    }
    
    //Rank
    if(command === "rank") {
        const user = await Levels.fetch(message.author.id, message.guild.id);
        message.channel.send(`You are currently level **${user.level}**!`)
    }
    
    //Leaderboard
    if(command === "leaderboard" || command === "lb") {
        const rawLeaderboard = await Levels.fetchLeaderboard(message.guild.id, 5);
        if (rawLeaderboard.length < 1) return reply("Nobody's in leaderboard yet.");

        const leaderboard = Levels.computeLeaderboard(bot, rawLeaderboard); 

        const lb = leaderboard.map(e => `${e.position}. ${e.username}#${e.discriminator}\nLevel: ${e.level}\nXP: ${e.xp.toLocaleString()}`);

        message.channel.send(`${lb.join("\n\n")}}`)
    }
  }
}
#

Failed to append xp: MongoWriteConcernError: No write concern mode named 'majority[object Object]' found in replica set configuration

#

what is mistake

tired panther
#

This white is too light

lyric mountain
#

Check button docs

#

See what color is used for ot

#

It looks like your green is too green tbh

#

Theirs is a bit dimmer

tired panther
lyric mountain
#

Color palette issues...as expected from discord

boreal iron
#

maybe he didn't like the first val name

#

and the second...

smoky kestrel
lament rock
#

Pretty sure json modules aren't added to require.cache, so it has to query the fs every time you require a json

#

you literally have 3 variables that are the exact same thing

#

requiring the same file

smoky kestrel
lament rock
#

I know it's not gonna fix it. I never said it would. I'm just pointing out that you have many other issues to worry about and not just that error if you require the same file 3 times

tired panther
lament rock
#

That looks fine. I still don't believe red text should be used unless it's for an error or something related

smoky kestrel
#

may be

smoky kestrel
#

still the same

lament rock
#

okay

#

so

#

what's the error

#

nvm. I looked underneath the code

crude egret
#

I don't understanf shards. What even is it?

lusty quest
#

the white is kinda hard to read on a monitor that can reach certain nits

earnest phoenix
#

Sharding is the method by which a bot's code is "split" into multiple instances of itself. When a bot is sharded, each shard handles only a certain percentage of all the guilds the bot is on.

crude egret
#

Oh... that is really cool

eternal osprey
#

hey guys

crude egret
#

Thanks

eternal osprey
#

is ytdl-core still not working and broken?

#

I still get the same 404 error

wheat mesa
#

Try updating. My ytdl-core seems to work perfectly fine for the time being.

nimble kiln
#

I thought ytdl was shutdown

wheat mesa
#

I think it was for a few weeks

#

Then GitHub put it back up after some sort of legal thing

nimble kiln
#

Ah yeah

crude egret
#

What is ytdl?

pale vessel
earnest phoenix
#

What is wrong?

nimble kiln
earnest phoenix
earnest phoenix
crude egret
earnest phoenix
#

I want to get the bot out if no one is in the vc.

nimble kiln
#

Oh it's a seperate thing for javascript/node, alright

earnest phoenix
#

I'm a beginner.

vivid fulcrum
#

hi a beginner, i'm dad

earnest phoenix
tough terrace
#

Who’s developers?

crude egret
#

I try to be 🤣

cinder patio
#

surely not the peope with the bot developer role

crude egret
#

Surely not

#

Really? 🤣

earnest phoenix
#

"peope" dank memer has no bot developer role

restive furnace
#

haha funny

earnest phoenix
#

anyways
can useEffect only run when the component is mounted?

vivid fulcrum
#

yes

#

pass an empty array as the second argument

earnest phoenix
#

pog

#

wait so that counter-intuitively means if i have a lot of useStates i need to put a thicc dependency array?

vivid fulcrum
#

essentially yeah

#

though that depends on what you're trying to do

#

if you want the effect to run on a re-render (regardless of what's changed) you don't have to pass in a second argument at all

#

also an fyi

#

you can use multiple effects

tulip ledge
#

euhm

vivid fulcrum
#

code & stacktrace

cinder patio
#

looka like you're calling the return value of console.log

#

console.log(....)()

stray seal
#

Can someone help me? I have a line of code and dont know where to add it lol

earnest phoenix
#

you add it at the top

#

That’s like asking how do you sit down

wheat mesa
tired panther
small tangle
#

so am i dumb, but mongodb locally should have faster response times than mongodb atlas, or?

lusty quest
#

well you dont have to send the data across the internet

#

overall i would also suggest to cache Database calls

#

especally Mongodb bcs it does not cache with the free version

small tangle
#

i guess the difference is bigger, when my internet is shit

earnest phoenix
#

Pfft caching is for losers trollge

small tangle
#

i make db calls on every presence update Kappa

earnest phoenix
#

Uh

lusty quest
#

wtf?

small tangle
#

nah nah jk

lusty quest
#

you might want to cache stuff

small tangle
#

have the intent disabled

earnest phoenix
#

I fetch stuff on every message cause I’m cool

small tangle
#

but yeah should thought more which data is good to cache

lusty quest
#

did you call every time a message is called the Database to get the prefix?

earnest phoenix
#

Any data that you need a lot is good to cache

small tangle
#

since my bot is now slashcommand only, no

earnest phoenix
#

Since you can just update cache and db at the same time

lusty quest
#

i would cache guild configs for sure

earnest phoenix
#

And never really fetch again

lusty quest
#

just update it in the cache

earnest phoenix
#

And db

#

You wanna update the db as well

#

👀

small tangle
#

rn im using mongodb atlas, but now im installing an ubuntu server on my pi and im looking how thats gonna turn out FeelsSmartMan

lusty quest
#

there are different methods tho, like you could write a helper to shedule writes to the DB or use a helper to update the cache on Database calls

#

MongoDB on a RPI, thats a good combo, like i saw so many corrupted databases bcs of this combo

small tangle
earnest phoenix
#

Mmmm true

lusty quest
#

remember, power the pi down, not just yeet the cord

earnest phoenix
#

I’m more talking about set it in the cache and update in the db as well

#

And when fetching fetch from cache

small tangle
earnest phoenix
#

So you always have an updated cache but at the same time when the bot restarts it refetches from the db to refill the cache

lusty quest
earnest phoenix
#

Lol

#

Sounds very pog a corrupted db

small tangle
#

im generally dont shutdown this way

lusty quest
#

like my RPI who runs a Pihole got a UPS to stay powered

earnest phoenix
#

UPS?

lusty quest
#

Uninteruptable Power Supply

#

(backup Battery)

#

even if we have a blackout the pi stays powered and i could shut it down normaly

boreal iron
#

Why are you worried about if it shuts down uncontrollably?

#

Data loss?

lusty quest
#

it sort of Controls all the DNS requests in the local network, if it dies nobody can connect to the Internet properly

boreal iron
#

Yeah I know got RaspberryPI OS on my server, too but clients will be cut off electricity, too as well as the router oldEyes

lusty quest
#

well what if due to a bad write during a poweroutage will corrupt the SD card? electricity comes back, eventually and noone can connect to the internet

#

bcs the DNS requests end up in a void

boreal iron
#

lol never run into such an issue the last 10y

lusty quest
#

also the UPS powers my Switch and some POE injectors

boreal iron
#

Can’t just FedEx do the job for you

lusty quest
boreal iron
#

Watch out sarcasm has been spotted

lusty quest
#

the same i do with my hardware, sort of

#

i cant sense sarcasm

#

sorry

boreal iron
lusty quest
#

well you probably still want that the data on it is not at risk right?

boreal iron
#

Well I’m more worried about the host OS but no I don’t expect data corruption just by a electrical outage

lusty quest
#

get a HBA with BBU

boreal iron
#

That last one didn’t made sense

#

Thought about that already but common devices can held up the system for a few minutes only

#

I was thinking about a gas energy PGU

lusty quest
#

a HBA with BBU usually gives HDDs the ability to finish the last rotation and park the Read head.

boreal iron
#

Since there a lot of electrical outages this days

lusty quest
#

not more

boreal iron
#

Nah I was speaking about power generation

lusty quest
#

well be like my Dad, who bought a Balling Aggregate from the Military, with enough Power to power half the Village

#

like it where used as a Backup Generator for a Military base

boreal iron
#

The issue is the size of the house and the fact the router is placed in a different floor

#

If I’m gonna invest in such a system all necessary devices should be attached to it

#

Such as the light, server, router etc.

lusty quest
#

if we would attach the Generator to the House Circut we could just carry on not Caring about the power Outage

boreal iron
#

And probably the fridge oldEyes

#

Yeah unfortunately that’s not so easy as the way to the fuse box is long and I renovated a few years ago
Not willing to break up the walls again

strange lance
#

Hello

boreal iron
#

Should have think about that before

strange lance
#

I got this error recently , idk what to do

mild agate
#

Cloudflare blocked your request

strange lance
#

What's cloudflare

mild agate
strange lance
#

Should I have to change the domain Just . Or anything more

mild agate
#

you have been blacklisted from discord it seems

strange lance
#

Where , I can still chat

mild agate
#

ur server

strange lance
#

My bot have gone offline...

#

Just

#

Nothing happened to me

mild agate
#

check this

strange lance
#

Okh sure 😉 thanks bro

mild agate
#

looks like you abused ratelimits or the api and got a temp ban from the api

strange lance
#

Oh I see API problem..

#

but can't I find out from which specific Api

strange lance
mild agate
#

Discord API

#

use some logic... we are talking about discord here...

strange lance
#

I used many local APIs too

#

@mild agate it is fixed , I just changed the domain of Website , now will fix Api problem Tommorow too .. thanks for help

vivid fulcrum
#

discord is actively blocking free hosting ips

#

i don't remember if that includes replit

north socket
sick agate
#

People use replit to abuse discord api

sudden geyser
#

Feature creep.

earnest phoenix
#

Hi, so I want to do: js db.collection("channels").insertOne({_id: server.redirect}) || {_id: message.channel.id, bey: "nothing", type: "nothing", answer: "number", settings: {spawn: true, dcommands: []}};
only a single time, like check if it doesn't already have a database like this and if it doesn't, it will insert it, but if it does, it does not. I hope I was clear.

Any idea how I can do that?

quartz kindle
earnest phoenix
#

I've never used upsert

earnest phoenix
#

not sure what do do with that

#

oh ok

#

thanks

tulip ledge
#

So I have this array of users and their levels:

let array = [ { level: 10, xp: 50 }, { level: 7, xp: 20 }, { level: 10, xp: 20 }, { level: 2, xp: 10 } ];

How do I sort this array based on level AND xp so that the array will be formatted like this:

let array = [ { level: 10, xp: 50 }, { level: 10, xp: 20 }, { level: 7, xp: 20 }, { level: 2, xp: 10 } ];
sudden geyser
earnest phoenix
tulip ledge
odd sapphire
#

Is Mongo working for anyone else? I'm getting error but nothing is logging in console

earnest phoenix
#

Hey

#

Can someone show me a example as to what a set channel code would look like

#

I been using channel id and channel name but I think it’s time to learn how to do set channel

#

@sick agate

sudden geyser
#

@earnest phoenix, there are many ways to tackle problems and implement solutions when it comes to programming. What you're asking is too broad, however. What library are you using? What does setting a channel do? What data is involved?

earnest phoenix
sudden geyser
#

So you want users to be able to configure (set) the channels for certain logs/actions (welcome messages in x, chat bot in y).

If so, what you're looking for is a database. A database is a way to persist data even after your bot has stopped.

earnest phoenix
#
from discord.ext import commands


LOGS = []
DATABASE_CHANNEL_ID = ....


class MyBot(commands.Bot):

    def __init__(self):
        super().__init__(command_prefix="!")
        self.discordDB = DiscordDB(self, DATABASE_CHANNEL_ID)

    @commands.command()
    async def log(self, ctx, *, text):
        data = {
            "name": ctx.author,
            "text": text
        }
        _id = await self.discordDB.set(data)
        LOGS.append(_id)

    @commands.command()
    async def show_logs(self, ctx):
        for _id in LOGS:
            data = await self.discordDB.get(_id)
            await ctx.send(f"Name: {data.name}, Text: {data.text}")


bot = MyBot()
bot.run("TOKEN") ```
#

Oh python

sudden geyser
#

You need a database (such as SQLite).

earnest phoenix
#

Lmao hold up I gotta codeblock that

#

Have fun

earnest phoenix
sudden geyser
#

Do you know what a database is?

earnest phoenix
#

Oh I gotta use a cmd handler also

sudden geyser
#

You're already using a command handler.

#

As for the database, you'll need to spend the time to research what a database is and how to use it, since it takes time to learn.

earnest phoenix
errant flax
#

how do i change the "boldness" of a text/paragraph in html/css

plain talon
#

<b></b>

#

or font-weight

#

font-weight can take like 300,400,500,600,700,800 etc

#

300 is thin, 900 is extra bold, 700 is normal bold

errant flax
plain talon
#

yup

errant flax
pale vessel
#

Numbers

plain talon
#

top line is font-weight: 700

#

the bottom line is font-weight: 300

quartz kindle
#

not all fonts support all those levels

#

90% of them dont

plain talon
#

yea, 300 and 700 are the defaults

#

300 is normal text, 700 is <b>

#

700 font

quartz kindle
errant flax
#

the numbers r in pixels right?

quartz kindle
#

no

plain talon
#

ooh default is 400 my bad

#

no its the font family differences

#

see the numbers

#

Regular 400, etc

errant flax
#

thx now i can mess around with it pd_pepethumbsup

boreal iron
# quartz kindle

Wow 700 is bolder than 600 but lighter than 800.
Who would have expected that KEKW
I like the guy who wrote that without knowing him

foggy umbra
#

Can anyone here Test if my bot works outside the US? If u live outside the us

pale vessel
#

Why not

crimson vapor
#

why would it not work outside the us?

pale vessel
#

Your bot is interacting with Discord, not the client

#

Unless you mean dashboard or something?

foggy umbra
#

Because it has to download a a bunch of files and safe it to my raspberry pi, idk how l,one that will take if someone is outside the us

foggy umbra
#

That’s all I’m not sure about

crude egret
#

Can anyone help me out with these errors. They are not causing any functional errors, but they are really starting to piss me off. The language is Typescript.

crimson vapor
#

it has to do with how you're typing it

#

you typed Player as an object

#

an object doesn't have property .id

#

you can type it as a Player interface

#
interface Player {
  id: string
}
#

or something

pale vessel
#

Player: any ggnoree

crude egret
#

How would I use interface in that function?

slender thistle
#

Any gang

pale vessel
#

You use the object, not interface

crude egret
#

Uhhh, what?

pale vessel
#

Err

crude egret
#

That other guy made sense xD

pale vessel
#
interface Player {
    id: string;
}

function something(player: Player) {
    player.id; // Valid
}```
crude egret
#

Ahh, thanks

#

What about this marvel of errors then? Same thing?

crimson vapor
#
type UserData = Record<string, Whatever Individual Player Data is typed as>
crude egret
#

You, my guy, are very smart xD Thanks

odd sapphire
#

How would I list all servers my bot is in, with the guild id and owners name, using eval command

#

javascript ^

lament rock
#

Why would you want to

#

doing so is usually an invasion of privacy

amber thistle
#

when i add this to make my bot's pfp a circle

.entity-header__image{
 border-radius: 50%;
 transition: 0.5s;
}

it make it a circle, but when i add another element :hover to it, the avatar is back to its original shape (not a circle) and when i hover it, nothing happens

.entity-header__image{
 border-radius: 50%;
 transition: 0.5s;
}

.entity-header__image:hover{
 border-radius: 10px;
 box-shadow: -5px 5px black;
}
#

am i not allowed to use the :hover element?

#

oh wait its working now

proven lantern
#

bad code

#

good code

pale vessel
#

Could be shortened better_lollipop

proven lantern
#

?:

#

this looks the nicest

#

oh

#

return suffixMap[lastTwoNumbers] || suffixMap[lastNumber] || "th"

#

maybe

pale vessel
#

Yeah

#

??, if you can

#

It's more practical even if there's no difference in this case

proven lantern
#

i am a noob to the ??

#

that's node 16 min version right?

pale vessel
#

14 IIRC

proven lantern
#

mmkay, im on 14

#

yep, looks like it's working in 14

earnest phoenix
#

@proven lantern sub and substr are deprecated
use substring
and dont mind the names

pale vessel
#

@proven lantern You can also provide numberStr.substr() directly without assigning it to a variable, since they're only being used once

proven lantern
#

why don't intellij tell me this?

pale vessel
#

It's only sub, not substr

proven lantern
#

wait i thought one mutated the string

#

an evil mutation function

#

those are the worst type of fake functions

#

nm, they just work differently

#

they better not deprecate substr()

pale vessel
#

Only sub() is deprecated

proven lantern
#

nice

earnest phoenix
#

I wonder what they do tho

proven lantern
#

string.substring(start, end)
vs
string.substr(start, length)

pale vessel
#

I only ever used slice

proven lantern
#

splice is one of those fake functions. slice is a real function

pale vessel
#

splice() is for arrays

proven lantern
#

so is slice right?

pale vessel
#

Yeah

proven lantern
#

i didnt know that worked on strings too

#

not splice though

#

splice should just be thrown in the garbage anyways

pale vessel
#

Why?>

proven lantern
#

they even say to use slice in the definition

#

functions that modify stuff are not pure

pale vessel
#

You can't remove/add element(s) to an array at a specific index without using any loop without splice()

#

So I'd say it's a pretty nifty (albeit slow) method

#

It has its use cases

proven lantern
#

it can always be avoided

pale vessel
#

Yeah

proven lantern
#

i see that as a code smell

grand salmon
#

.env

proven lantern
#

safest way is to save the token in a DB and write code to fetch the token

proven lantern
errant flax
proven lantern
#

if you already have a DB then its basically free

earnest phoenix
#

bruh

#

where will you store the db passwords then

#

there's a reason .env files exist

hidden coral
earnest phoenix
#

im trying to figure out what went wrong with env files that you have to use a db

errant flax
#

much more quicker than awaiting and getting the data and setting up a schema for it

#

also how do i get a website's ip im on mobile bonk

earnest phoenix
#

@errant flax or protect token from getting stolen using this hacking protection:

const token = "Nzd9w82jkdks" + "92938jeejj";
proven lantern
latent heron
#

you could also consider encrypting the token and later undoing it when it needs to be plugged in if you're really spaz about protecting tokens

proven lantern
#

like the DB

earnest phoenix
latent heron
#

correct

earnest phoenix
#

@proven lantern replit has some restrictions on env files:

  • repls forks dont copy .env
  • scripts from the cli cannot access .env
  • only multiplayer/team members can see it
  • (not verified yet) the stuff is encrypted and stored
errant flax
#

imagine forking a repl then .env is there :KEKA:

pale vessel
# earnest phoenix GUYS I JUST FOUND GOLD https://youtu.be/-bt_y4Loofg

MongoDB is proud to present this awesome parody music video featuring our new Atlas technology.

For more information on MongoDB Atlas visit: https://bit.ly/3fGBDn9

Subscribe to MongoDB ►►► https://bit.ly/3bpg1Z1

Connect with MongoDB:
Website: https://bit.ly/2LjtNBZ
Twitter: https://bit.ly/3fH87gR
Facebook: https://bit.ly/3fEaIsd
Linkedin: ht...

▶ Play video
proven lantern
#

mongodb hosting is too expensive

clear marlin
pale vessel
#

If you want reliability, selfhost

proven lantern
#

sql is disk optimized and not cpu optimized so they are bad

earnest phoenix
#

do you have anything to do other than shit on stuff for no reason

crimson vapor
#

isnt atlas free up to like 512MB?

sick agate
#

It is

whole cedar
#

its replit just use .env

#

if your going to go threw all this trouble just get a raspberry pi or something simmer

cinder patio
proven lantern
#

101st

#

11th

cinder patio
#

which ends in*

#

ah

proven lantern
#

111th

lethal trout
#
case 'age':
                const age = args.slice(1).join(' ');
                const ms = require('ms');
                if (!age) return message.channel.send('Invalid time provided.');
                db.set(`age.${message.guild.id}`, ms);
                return message.channel.send(
                    `The required age has been set to **${age}**`
                );
                break;```
err: https://media.discordapp.net/attachments/766116919983079434/865120334658142238/unknown.png
sly sierra
#

change age. to age_

#

in the db.set

lethal trout
sly sierra
#

insticts tell me it will fix it

lethal trout
sly sierra
#

thats not how it works

lethal trout
sly sierra
#

its just const ms = require('ms')

lethal trout
#

oh wait

lethal trout
#

like that?

pale vessel
spare badger
lethal trout
pale vessel
#

Nice

#

I totally skimmed through that

lethal trout
#

using ms

pale vessel
#

and how do you import ms?

#

It's not const ms = "ms"

lethal trout
#

TypeError: ms is not a function

case 'age':
                
                const ms = ('ms');
const age = ms(args.slice(1).join(' '));
                if (!time) return message.channel.send('Invalid time provided.');
                db.set(`age.${message.guild.id}`, ms);
                return message.channel.send(
                    `The required age has been set to **${age}**`
                );
                break;```
pale vessel
lethal trout
#

(node:37) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of null

    let bypassed = db.get(`bypass.${guild.id}`) 
    if (bypassed.includes(user.id)) return;
    if (Date.now() - user.createdTimestamp > age) {
        member[punishment](
            `Alt detected - Account younger than ${client.decodeMs(age)}`
        );```
lethal trout
pale vessel
#

bypassed is null

lethal trout
pale vessel
#

You can't access property includes of null

#

Just like the error says

lethal trout
pale vessel
#

Make sure bypassed exists first

#

if (bypassed && bypassed.includes(...)) or if (bypassed?.includes(...))

lethal trout
#

@pale vessel

let bypassed = db.get(`bypass.${guild.id}`) 
    ///if (bypassed.includes(user.id)) return;
if (bypassed && bypassed.includes(user.id)) return 
    if (Date.now() - user.createdTimestamp > age) {
        member[punishment](
            `Alt detected - Account younger than ${client.decodeMs(age)}`
        );```
#

liike this?

hidden coral
#

Guys how do I make a login system to my bot website? I just want an easy login system with oatuh2 no need of guilds just need their user ID AND USERNAME

spare badger
#

If you come across any specific issues feel free to drop em.

earnest phoenix
#

Okay so

#

For using white mode

latent heron
#

which is a sin

earnest phoenix
#

You deserve no help OMEGALUL

proven lantern
#

why would cordChoice be undefined in the play function?

    let nextBoard = [...initialBoard].map(row => [...row]);
    let nextCordChoice = [0, 0];
    let nextPlayer = "x";
    while (!checkIsComplete(nextBoard)) {
        const {player, board} = play({player: nextPlayer, board: nextBoard, cordChoice: nextCordChoice});
        nextPlayer = player;
        nextBoard = board;
        nextCordChoice = nextCord([...nextCordChoice]);
        console.log(board);
    }
}

run();```
knotty talon
#

anyone do HTML CSS

#

I'm just getting started

earnest phoenix
#

Just ask what you need help for and you'll see ¯_(ツ)_/¯

proven lantern
#
}```
#

lol

knotty talon
#

my problem is this

#

100x zoom

#

150x zoom

spare goblet
#

are you manually placing these on absolute positioning or something

knotty talon
#

oh yeah

spare goblet
#

it's all positioning issue, position using flexbox instead

knotty talon
#

oh ok

#

ty

spare goblet
#

no worries, you just have to put it in a flexed column and center align everything

latent heron
#

flex-align would also be a good choice

#

using flexing grid controls offers better versatility in modifying the position over forcing position values

proven lantern
#

anybody want my tix tac toe game code

#

it's not done

timber fractal
#

so this is my code i use to define the command variable and get the files so i can let my command handler run them but i want it so that in the commands map i can have different maps where i can have the commands sorted in (like in the image below) can someone help me what i have to do then?
code: https://srcb.in/YUkPoaDpQp
image below

#

anybody who can help?

solemn latch
#

Basically you want categories by folder name?

knotty talon
#

anyone do HTML CSS

#

Woo, I clicked the sus link

solemn latch
#

Lol

knotty talon
#
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link href="https://fonts.googleapis.com/css2?family=Baloo+2:wght@700&display=swap" rel="stylesheet">
    <link href="animated_background.css" rel="stylesheet">
</head>

<div class="animation-area">   
    <ul class="box-area">
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</div>

  </html>```
#

html

#
* {
    margin: 0;
    padding: 0;
}
.animation-area {
    background: linear-gradient(to left, #8942a8, #ba382f);
    width: 100%;
    height: 100vh;
}
.box-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.box-area li {
    position: absolute;
    display: block;
    list-style: none;
    width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    animation: animate 20s linear infinite;
    bottom: -150px;
}
.box-area li:nth-child(1) {
    left: 86%;
    width: 80px;
    height: 80px;
    animation-delay: 0s;
}
.box-area li:nth-child(2) {
    left: 12%;
    width: 30px;
    height: 30px;
    animation-delay: 1.5s;
    animation-duration: 10s;
}
.box-area li:nth-child(3) {
    left: 70%;
    width: 100px;
    height: 100px;
    animation-delay: 5.5s;
}
.box-area li:nth-child(4) {
    left: 42%;
    width: 150px;
    height: 150px;
    animation-delay: 0s;
    animation-duration: 15s;
}
.box-area li:nth-child(5) {
    left: 65%;
    width: 40px;
    height: 40px;
    animation-delay: 0s;
}
.box-area li:nth-child(6) {
    left: 15%;
    width: 110px;
    height: 110px;
    animation-delay: 3.5s;
}
@keyframes animate {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-800px) rotate(360deg);
        opacity: 0;
    }
}
#

css

#

Problem: when zooming its not zooming in the center

cinder patio
#

people already told you to use flexbox

knotty talon
#

sorry idk what that is

#

I tried to search idk where to put

cinder patio
#

google is your friend

knotty talon
#

I did SadCat

timber fractal
timber fractal
solemn latch
#

Can you show what you tried?

timber fractal
#

its super dumb lol

#

i just tried to almost copy this part and paste behind so like this

readdirSync(join(__dirname, "commands")).readdirSync(join(__dirname, "bot devs")).filter(file => file.endsWith(".js"));```
solemn latch
#

Honestly pretty close.
Or well on the right track.
Lemme hop on my pc

timber fractal
#

okay thx

hollow aurora
#

i want to add spotify api to my bot

#

where could i get that

solemn latch
hollow aurora
#

thanks mate

#

is it same as youtube api ?

timber fractal
#

did u got on pc already?

hollow aurora
#

i am using replit

solemn latch
# timber fractal okay thx
 const categoryFolders = readdirSync(join(__dirname, "commands"), { withFileTypes: true })
    .filter(directory => directory.isDirectory())

^ will get you an iterate-able of folders

you can then iterate over them just like your doing with folders.

for(const folder in categoryFolders) {
  //command code your using now here, just modified to put them in their own maps.

}
solemn latch
timber fractal
#

okay thx

timber fractal
#

@solemn latch like this or something else

#

e

solemn latch
#

pretty close.
youll need to search for command files(commandFiles) in each folder loop(for(const folder in categoryFolders))

#

then youll need to modify your command require to look in the folder

frozen mesa
#

const logchannel = client.channels.cache.get("id")

timber fractal
#

could you give an example maybe?

frozen mesa
#

Ur welcome cathi

solemn latch
timber fractal
#

this doesnt work and says there's no such file or directory but i dont know why it says

halcyon moss
#

i am coming

timber fractal
#

it isnt even looking in the commands folder why is that?

halcyon moss
#

idk it join my server and nothing happenimg

hidden coral
halcyon moss
#

i think i get it thanks

solemn latch
jovial nexus
#

im having a ts error when trying to do a extended client:
TypeError: Class constructor Client cannot be invoked without 'new'
the code:

import { Client, Collection } from "discord.js"
import { conf } from "../conf"
import { Logger } from "./logger";

export default class deBot extends Client {

    public commands: Collection<string, any> = new Collection()
    public conf: any = conf
    public logger: any = Logger

    public constructor() {
        super({
            restTimeOffset: 200,
            shards: 50,
        })
    }

    public async start() { await this.login(this.conf?.token).catch(console.error) }

}
hidden coral
#

@solemn latch see Dms bro

timber fractal
#

could you help me?

vivid fulcrum
#

pay me and i'll give you the code

hidden coral
frozen mesa
vivid fulcrum
#

well, if you want someone to do work for you, pay them

#

otherwise do it yourself

#

welcome to capitalism

hidden coral
vivid fulcrum
#

veld's not doing any work for me though?

fair axle
#

What is VIEW_GUILD_INSIGHTS exactly?

vivid fulcrum
#

the permission? iirc it has something to do with lurking permissions

fair axle
#

I know this is a permission but what does it do?

slender thistle
vivid fulcrum
#

allows you to access this page

#

yeah

fair axle
#

Thanks

hidden coral
spare badger
#

You will need Javascript for that.

#

Unless you want to do it as a query parameter like https://discord.com/?parameter=CONTENT_WRITTEN_IN_INPUT

#

You could just use a <form method="GET" action="https://discord.com"> form tag for that.

native plover
#

how can i send dm to users with ID on a vote event ( without using intents )

cinder patio
#

I'm pretty sure you don't need any intents to just fetch the user data?

pale vessel
#

Why do you need to fetch the user?

#

Name change 👀

cinder patio
#

if you're using discord.js you have to cause bad design 😬

pale vessel
#

😬

cinder patio
pale vessel
#

🩴

#

WYM

jovial nexus
#

does someone know why my bot has memory leaks but only when the privileged gateway intents are enabled

#

??

wary flame
#

Because with more gateway intents it caches more

lyric mountain
#

privileged gateways greatly increase caching yes

jovial nexus
#

yes

lyric mountain
#

one is about guild members, the other about user presences

jovial nexus
#

but it gets very high

vivid fulcrum
#

if you don't need presences, turn them off

jovial nexus
#

like 600mb with 20 servers

wary flame
#

Presences are very high memory

jovial nexus
#

that high?

lyric mountain
#

you see, presences are cached:
A - when an user joins vc
B - when user online status changes
C - when user status message changes
D - when user joins server

#

and caches have a lower limit, so it'll fill up to a point, then it'll start swapping older objects with newer ones

vivid fulcrum
#

if you're using djs, you're also using one of the libs with the worst optimization out there

jovial nexus
#

well

wary flame
#

If you use discord.js-light you should be able to switch without changing any code and disable all unnecessary caching

#

Or use detritus (Erwin will be happy) but that requires changing code

south sinew
#

Or use discord-rose (Berry will be happy) for full cache control 😉

quartz kindle
#

berry the platypus

solemn latch
#

Or make your own lib (no one will be happy) for whatever you want

south sinew
#

Or don't make a lib and make direct calls for everything (You won't be happy)

split hazel
#

pfsh imagine not modifying discordjs to fit your needs

south sinew
#

Imagine using discordjs

plain talon
#

imagine

cinder patio
#

imagine making discord bots

quartz kindle
#

imagine dragons

willow mirage
#

imagine knowing every object value and keys of djs (well Class too)

cinder patio
#

test me

coarse topaz
#

Hello there, I'm getting the following error:
"(node:24) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'members' of undefined"
But I don't see any error in that part of the code, it even used to not display any error before - Dunno if discord.js updated its API or something

Here's the code

  let hotw_committee_members = message.guild.roles.cache.get(hotw_committee_role).members;```

Please ping me when replying, thanks 🙏🏼
lyric mountain
willow mirage
willow mirage
lyric mountain
#
  1. Exist but isn't cached
willow mirage
#

Solution: message.guild.roles.fetch(ROLE_ID)

#

i guess

#

if fetch() exist

native plover
willow mirage
#

wait there is a get_user() ?

native plover
willow mirage
round cove
#

Do I need specific intents to use raw packets? (DJS)

lusty quest
#

if intents are not enabled they are not send iirc

round cove
#

Or is the newest version of DJS just messed up?

eternal osprey
#

i am constantly updating my music bot (ytdl-core) however, it keeps falling back to its older ytdl-core build.

round cove
#

Mmm

eternal osprey
#

Is there any reason behind that

lusty quest
#

just use lavalink at this point lol

eternal osprey
lusty quest
#

ytdl is just a clusterfuck of a repo

eternal osprey
#

i heard that they fixed everything in the latest build

#

but my program keeps using the older build, eventhough everything installs correctly.

lusty quest
#

not having used stuff is no excuse, like you probably never used js at one point, but now you use it

eternal osprey
#

yeah but i don't have the time to start everything all over again. Maybe somewhere in the future.

#

wait

#

i actually have time this weekend

lusty quest
eternal osprey
#

i now only use mongodb

#

😋

round cove
#

I guess raw events don't catch delete message content.

slender thistle
#

Yeah, they don't

wheat mesa
#

Did that for my bot a little while ago, seemed to do the trick

round cove
eternal osprey
#

i tried it

#

WARNING: ytdl-core is out of date! Update with "npm install ytdl-core@latest".
node_modules/discord-ytdl-core/node_modules/ytdl-core/lib/utils.js:175

#

still

#

same error

solemn latch
#

are you using a host which has older node versions?

wheat mesa
#

Wait... are you using discord-ytdl-core?

eternal osprey
wheat mesa
#

discord-ytdl-core depends on ytdl-core iirc. Don’t use it. Just use ytdl-core

#

The reason it’s out of date is because it’s trying to update the ytdl-core within your discord ytdl

eternal osprey
#

oowh

wheat mesa
#

Which hasn’t seen an update in like 2 years afaik

eternal osprey
#

i can uninstall it like: npm uninstall ... right?

wheat mesa
#

Yes

eternal osprey
#

Will do that, thanks man!

wheat mesa
#

Np

#

I had lots of problems when I tried to use discord-ytdl-core

#

All of them got fixed from just swapping to normal ytdl-core

timber fractal
#

so this is my code (https://srcb.in/BRuPFiwKyO) but when i try to run a command it says (node:19288) UnhandledPromiseRejectionWarning: TypeError: command.run is not a function while i use the exact same code on my other bot and it works perfectly there

#

so can someone help?

wheat mesa
#

Isn’t it .execute() for djs per the official guide?

timber fractal
#

no i use a different way

#

command.run works perfectly on other bots

wheat mesa
#

Do you have the run function set exported in your commands

#

Paste the code for one of your commands

timber fractal
#
const Discord = require('discord.js');


module.exports = {
    name: "COMMAND_NAME",
    aliases: ["COMMAND_ALIASES"],
    description: "COMMAND_DESCRIPTION",
    catogery: "COMMAND_CATOGERY",
    usage: "COMMAND_USAGE",
    cooldown: COMMAND_COOLDOWN,
    ignored_roles: ["COMMAND_ALLOWED_ROLES"],
    ignored_channels: ["COMMAND_ALLOWED_CHANNELS"],
    developer_only: COMMAND_DEVELOPER_ONLY,
    async run (client, msg, args) {
        //code goes here
    }
}``` this is my command default so yes i have
wheat mesa
#

Okay

#

I’ll test something rq

timber fractal
#

ok

cinder patio
#

Ok what tf am I doing wrong

#

material-ui never wants to work

timber fractal
#

hi google

nimble kiln
#

catogery? Thonk

timber fractal
#

dont tell me ur the real google

cinder patio
#

I'm assuming there's something going with the CSS but I've got no clue what might be going on

timber fractal
nimble kiln
#

It's a spelling mistake

#

It's spelled Category

timber fractal
#

lol oops

nimble kiln
#

I mean if it's just variable names etc. it doesnt really matter

#

But if it's a text string somewhere where a user can see it you should change it :]

cinder patio
#

oh god using material-ui with next.js is a pain

timber fractal
timber fractal
#

omg @wheat mesa im sorry im so stupid it doesnt work cuz i didnt finish the command yet lmao

wheat mesa
#

Yeah, I felt like that could be the only thing wrong

nimble kiln
#

Did you find your own error?

#

😛

timber fractal
#

yep

#

it didnt save

nimble kiln
#

oh

timber fractal
#

i mean

#

i missed 2

#

it did save

#

ok push to github

#

after commiting

earnest phoenix
#

please dont tell me this is a heroku integration to github we're talking about

tired panther
#

why is this not in the same row?
let me show my css code

latent heron
#

I don't like using other channels for non-intended purposes

pearl fern
#

yeah i understand

latent heron
#

use this

pearl fern
#

so does discord just automatically detect it now

latent heron
#

yeah

pearl fern
#

oh nice

#

ok

latent heron
#

discord has a lot of new markdown tool integrations now

#

they're implementing tooltips soon iirc

pearl fern
#

thats cool

#

discord is really caring about bots and new small features now

#

its good

latent heron
#

yeah

#

i'm excited for the polls

#

I think that's what is coming next in terms of interactions for the v9 API

#

and polls is a big pepega moment

pearl fern
#

wow discord is already on v9 api

#

thats like the highest ive ever seen an api

tired panther
# tired panther why is this not in the same row? let me show my css code

The Buttons are not showed inline

   .shard-button{
    margin-left: 7px;
    margin-right: 7px;
    margin-top: 2px;
    margin-bottom: 2px;
    border-style: solid;
    border-width: 4px;
    border-radius: 7px;
    padding: 2px 2px 2px 2px;
    text-align: left;
    font-size: 1em;
}
  .shard-button.ressource{
    background-color:#202225;
    border-color: #202225; 
    border-top-width: 1px;
    border-bottom-width: 1px;
    margin: 0px 3px 0px 3px;
    float: right;
  }
 <div id="shard-button<%=i%>" class="shard-button">
                      <p id="shard-button-name<%=i%>" class="shard-button <%=classname%>"><b>Shard <%=post.id %></b>
                      </p>
                      <p id="shard-button-log<%=i%>" class="shard-button log <%=classname2%>">
                        <%=post.message%>
                      </p>
                     <p class="shard-button ressource"> T </p>
                    </div>
tired panther
umbral lake
#
InternalOAuthError: Failed to obtain access token
    at Strategy.OAuth2Strategy._createOAuthError (/home/runner/SynapseBotList/node_modules/passport-oauth2/lib/strategy.js:408:17)
    at /home/runner/SynapseBotList/node_modules/passport-oauth2/lib/strategy.js:175:45
    at /home/runner/SynapseBotList/node_modules/oauth/lib/oauth2.js:191:18
    at passBackControl (/home/runner/SynapseBotList/node_modules/oauth/lib/oauth2.js:132:9)
    at IncomingMessage.<anonymous> (/home/runner/SynapseBotList/node_modules/oauth/lib/oauth2.js:157:7)
    at IncomingMessage.emit (events.js:326:22)
    at IncomingMessage.EventEmitter.emit (domain.js:483:12)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

I do what?

lusty quest
#

passport fails to get an access token, my best guess is that your flow is wrong

umbral lake
#

my flow is wrong??

#

what is my flow? xD

#

sorry I'm french I don't understand 100% english @lusty quest x)

pale vessel
#

Your fl0w?

lusty quest
#

your workflow for how to authenticate

umbral lake
#

idk and after not works

lusty quest
#

did you refresh the auth token?

umbral lake
eternal elbow
#

Can we somehow see the order in which users enter the voice channel?

wary flame
tired panther
#

Why does the Button go under the other Button?
on the second one it works, but on the upper ones, it goes under the button.

I didnt used any z-index
(Button expands on Hover)

woeful pike
#

use flexbox

tired panther
cinder patio
#

Next-js: how can I add a static image to my page

<BigAvatar>
        <Image src="/static/images/avatar.jpg" alt="Avatar" width="300px" height="300px"></Image>
 </BigAvatar>

File structure:

- src
  - pages
      - index.ts
- public
  - static
    - images
      - avatar.jpg

Tried literally everything, I always get the error Failed to load resource: the server responded with a status of 400 (Bad Request)

#

Also I'm using the create-next-app template, I've barely changed anything

median moss
#

little JS help:

I declared

let image = 'link here'```

then on Embed I put

```js
.setImage(image)```

How can I make something like:
```js
if(image === null,undefined or something) {
return message.channel.send('Invalid')
}```?

I tried making image === undefined, but it didn't work
#

the let image = a link + args[0]

sudden geyser
#

You may want to check if args[0] is null (assuming the user needs to add input to the command)

clever agate
#

does anyone recommend me any Discord oauth2 in JS?

median moss
#

is this posible?

sudden geyser
#

Yes.

#

But how to do so depends on what the link is

#

For example, you could download bits of the image and determine if it's an image.

median moss
#

this is the link

#

kind of

#

this for example

sudden geyser
#

With that link, you'll get a 404 Not Found if the image doesn't exist.

median moss
#

yes

sudden geyser
#

You could send an HTTP request (e.g. with node-fetch) and see if it errors.

median moss
#

hm

#

I never did that kekw

#

I'll try

#

thx

#

@sudden geyser what am I supposed to fetch? Like, what should I ask to fetch

sudden geyser
#

The constructed URL.

median moss
#

yeah, but it asks for a "fetch option"

sudden geyser
#

Are you using the fetch API?

median moss
#

this one

sudden geyser
#

The options are optional.

#

You probably won't need them.

median moss
#

so I just don't put nothing

#

ok

#

and then how do I recieve of it the answer?

#

like, if image is 404 how I will recieve it?

lyric mountain
#

you won't, that's the catch

median moss
#

it will give me what kind of error or smth?

earnest phoenix
#

Why do I get this error? xl TypeError: 'itemc' is not a constructor
Here's a portion of my code: js let stats = await db.collection("users").findOne({_id: message.author.id}); let item = parseInt(args[0])-1; let itemc = client.items.get(forsale[item]); let iteme = new itemc();

sudden geyser
#

That could be coming from a lot of places

median moss
#

do you know where I can find them?

earnest phoenix
lyric mountain
#

forsale is never defined

#

done editing already?

median moss
#
let imagefetch = new Request(image)

    if(imagefetch === ???) {
      return message.channel.send('Incorrect Pokémon name')
    }```

I'm trying to make something like that, replacing ??? with the response object for 404 image
sudden geyser
#

itemc is not a constructor (aka you can't use new)

median moss
#

ok

#

ty

sudden geyser
#

It's probably an instance rather than a type.

earnest phoenix
# lyric mountain forsale is never defined

it is, here: js const forsale = ["Buddy Bey Kit", "x1.5 EXP Booster 1 Hour", "Toolbox", "Perfect Constructor", "3 Premium Tickets Chest", "10 Premium Tickets Chest", "35 Premium Tickets Chest", "Void Meat", "Gift Box", "Avatar Embryo", "BeyLauncher LR"];

#

it's added before the lines of code I've sent

lyric mountain
#

I was referring to the pre-edit error

earnest phoenix
#

ah

#

i see

median moss
#
let imagefetch = new Request(image).then(r => {
          console.log(r.status);
        })

    if(imagefetch.status === '404') {
      return message.channel.send('Incorrect Pokémon name')
    }```

It's sending 404 on console, which is the error status, but it still answer the normal message on discord, not the error message
#

we are

boreal iron
#

Is the status is a string? “404” means string, 404 would be an integer

median moss
#

didn't work

#

yes

sudden geyser
#

You need to resolve it first then check the status.

median moss
#

hm

#

ok

#

thx

#

sorry for being noob, I'm still new at coding and never used node-fetch before

quaint rampart
#

anyone know how to scrape data off of sites? dm me

boreal iron
#

In that case 404 would be an integer

sudden geyser
#

If you're new to programming, you may want to spend more time learning the language and its fundamentals.

earnest phoenix
#

I tried console.log-ging it and I got undefined for itemc, is this supposed to happen?

boreal iron
#

Be sure about what it is or simply don’t check the data type

sudden geyser
boreal iron
#

Which would be == 404

median moss
#

ok

median moss
quaint rampart
sudden geyser
#

Scraping is not easy for many

#

It's often easier to use the site's public API if it has one.

median moss
#

@sudden geyser @boreal iron @swift umbra Thanks so much for helping me. It worked 🙂

boreal iron
#

👍

earnest phoenix
#

Is it possible to disabled fs for Buffer function ?

#

Buffer.from() can access filesystem

next quartz
#

I need help with my bot I can't make it be online I tried but it's still offline <@&265125253443878912>

sudden geyser
#

You haven't provided enough information for users to help directly.

#

You could provide more insight into what's going wrong when running your bot and why it won't connect, but these are often signs of beginner issues, so you may be inexperienced.

next quartz
sudden geyser
#

Confused.

next quartz
#

When your on the Development dashboard there is something called interaction endpoint I really didn't understand that one I know what it means but I don't know what to write there@sudden geyser

sudden geyser
#

If you want to process slash commands through an HTTP server rather than a bot, you'll point it to your server's endpoint. If you aren't doing that, just leave it empty.

next quartz
#

Thanks for the help

#

Do you know how to add Commands to my own bot?@sudden geyser

sudden geyser
#

You need to process messages from users and the user's intent.

#

Often through a command handler.

quiet pawn
sudden geyser
#

Are you new to programming?

next quartz
quiet pawn
#

u didnt

#

no one does

#

no reason to lie have a nice day

next quartz
#

@quiet pawn

quiet pawn
#

thats not a mod

#

its a translater

next quartz
#

Damn☠️

quiet pawn
#

that doesnt give you permission

next quartz
#

Sorry then

quiet pawn
#

and i dont think they were telling you to ping the role

#

they were telling u how

#

with id

next quartz
#

I'm dumb asf

#

No cap

quiet pawn
tulip ledge
#

kekw

next quartz
quiet pawn
#

welp time to go fix my broken ass embeder

#

what do you know

#

js, py or?

tulip ledge
#

Question, are slashcommands possible in discordjs v12 or do I have to update to the dev build of v13?

quiet pawn
#

no idea

#

google it

tulip ledge
#

I know you have to update to djs 13 for buttons and shit

quiet pawn
#

i think they work on dj 12

next quartz
#

I want to make commands for my bot

quiet pawn
#

i may be incorrevt tho

quiet pawn
next quartz
#

Just explain how and I will try to understand the rest

quiet pawn
#

js, py or?

#

i cant explain

#

if idk what code u use

#

lol

tulip ledge
#

This does not require a discord.js update! It should work as long as you're using a modern version (anything v12 would probably work, obviously v12.5.1/latest is recommended) pog

quiet pawn
#

what handler?

#

and just normal d.js or?

tulip ledge
#

you mean library?

#

or handler

quiet pawn
#

nah

#

handler

tulip ledge
#

2 seperate things

quiet pawn
#

well both

tulip ledge
#

is djs a handler?

quiet pawn
#

no..

tulip ledge
#

pretty sure its a library no

quiet pawn
#

i mean command handler

tulip ledge
#

oh

quiet pawn
tulip ledge
#

lul

quiet pawn
#

and libas well

#

so ik if its normal d.js or

next quartz
#

I'm new on coding ☠️☠️

quiet pawn
#

just watch a yt video on it

#

its not hard

tulip ledge
#

well if you want to do commands you take a user's input using the message event, parse that message and check if the first argument starts with the bot's prefix if it does run the command

quiet pawn
next quartz
#

YouTube will make me handicap

tulip ledge
#

Don't htink you need youtube for that

#

I'm sorry, that was uncalled for

next quartz
tulip ledge
#

you take the input from a user

quiet pawn
#

if your new to coding

#

its good video set

tulip ledge
#

It was a joke

quiet pawn
#

for a basic handler

tulip ledge
#

I said he was already handicapped

quiet pawn
#

o

#

yea

#

probably

#

imma just end convo with that

tulip ledge
#

banana cat

eternal osprey
#

hey! What was the exact property to check if a message.author has specific roles? Wasn'tt it something like: message.member.roles.has(...)

sudden geyser
tulip ledge
proven lantern
#

who wants a coding challenge?

tulip ledge
sudden geyser
#

Some like to learn the language and how to program a Discord bot in parallel, but it's often inefficient as a source of learning.

proven lantern
#
const checkIsColumnWinner = board => false;
const checkIsDiagWinner = board => false;```
implement these 3 functions. 1st is easiest and 3rd is hardest
tulip ledge
sudden geyser
#

Of course.

sudden geyser
#

To learn the language you need to build a project with it.

#

Unless you're a massive book worm

tulip ledge
#

that has no extension friend

proven lantern
tulip ledge
#
[[null,null,null],[null,null,null],[null,null,null]]
[["x",null,null],[null,null,null],[null,null,null]]
[["x","o",null],[null,null,null],[null,null,null]]
[["x","o","x"],[null,null,null],[null,null,null]]
[["x","o","x"],["o",null,null],[null,null,null]]
[["x","o","x"],["o","x",null],[null,null,null]]
[["x","o","x"],["o","x","o"],[null,null,null]]
[["x","o","x"],["o","x","o"],["x",null,null]]
[["x","o","x"],["o","x","o"],["x","o",null]]
#

So I get the result of all of this?

#

right?

proven lantern
#

yeah, that's just printing out the automated moves

quartz kindle
#
function checkDiagWinner(board) {
    return (board[0][0] && (board[0][0] === board[1][1] && board[1][1] === board[2][2])) || (board[2][0] && (board[2][0] === board[1][1] && board[1][1] === board[0][2])) ? board[0][0] : false;
}
#

lmao

tulip ledge
#
const checkIsRowWinner = board => {
  let found = false;
  for (const row of board) {
    if (row.every(value => row[0] === value && value !== null)) found = true;
  }
  return found;
};
#

First one

proven lantern
quartz kindle
tulip ledge
proven lantern
eternal osprey
#

hey

quartz kindle
#

well your example was tick tack toe

eternal osprey
#

i actually forgot how to add multiple // lines in vsc

#

wasn't it like: //** or something

proven lantern
#

4x4 tick tac toe

#

no one ever wins even more

quartz kindle
#

4x4 with 3 in a row for win?

proven lantern
#

i was thinking full lines

#

but maybe a connect 4 type of game could be made

tulip ledge
#

wait

#

forEach

#

is that a mutation?

#

no right?

proven lantern
#

nope, but it's a void function

lyric mountain
tulip ledge
#

am I allowed to use forEach?

lyric mountain
#

ever heard of 3d tic tac toe?

proven lantern
lyric mountain
#

the issue with ttt is that the starting player always have a clear advantage

quartz kindle
#

how about 5d chess

tulip ledge
#
const checkIsRowWinner = board => {
  let found = false;
  board.forEach(row => {
    if (row.every(value => row[0] === value && value !== null)) found = true;
  })
  return found;
};
lyric mountain
#

bigger pieces can be put on top of smaller pieces

tulip ledge
#

I can try wuthout foreach if u want

lyric mountain
#

still, the starting player always wins if played right (or draw)

proven lantern
#

i was thinking of tic tac toe played in a 3d cube board

sudden geyser
tulip ledge
#

mmmh didn't think of using some

proven lantern
#
const isRowWinner = board => board.some(row => row.every(cell => row[0] === cell && cell));```
tulip ledge
#

well, can't we just flip the array on its side and run that to find column?

#

but that'd require a mutation

proven lantern
#

maybe making a copy somehow?

#

the reduce function can do anything