#development

1 messages · Page 1576 of 1

eternal osprey
#

yeah but i only hjave one program.cs and 1 csproj

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

just like you would say that it takes in any other type

#

enums are implicitly numbers

crimson vapor
#

so arg: any?

sage bobcat
#

One message removed from a suspended account.

eternal osprey
earnest phoenix
#

arg: YourEnumType

crimson vapor
#

oh

#

so string then

#

make sense

#

my enum is a string

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

yup

#

roslyn is super easy

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

it was before net core

#

so like

#

pre 2016? ish?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

.net 6.0 gonna be even more fun

#

two way java interop

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

minecraft plugins in .net mmLol

sage bobcat
#

One message removed from a suspended account.

dusky sundial
#

C# is fun as hell

sage bobcat
#

One message removed from a suspended account.

dusky sundial
#

too bad my high school switched to Python

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

dusky sundial
#

Well I don't go there anymore

#

but I feel bad for the kids

earnest phoenix
#

i'm waaaaaaay ahead of my class course right now

dusky sundial
#

Game development is pretty fun, I don't think they do game dev for the programming classes at my old high school anymore

earnest phoenix
#

that seems fun

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

we're doing sorting algorithms in cpp

#

dread

sage bobcat
#

One message removed from a suspended account.

dusky sundial
#

Mm, I'm doing cpp for college rn

#

no fun

#

Supposed to make a contact book, but we're not allowed to use databases no, file storage is the way to go apparently

earnest phoenix
#

circa 1996 development

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

there should be RCs in november i think

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

no idea

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

i understand how they would do one way interop

#

java -> c#

#

but two way is witchery

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

i'm really intrigued in how they plan on doing two way

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

translating to java bytecode? using pinvoke? no idea

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

well yes

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

nah

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

it's because c# implicitly depends on c++

#

they end up being the same thing at the low level

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

but using .net core binaries in node that weren't compiled as libraries is hard

#

because you then need to load all other binaries, like the runtime

sage bobcat
#

One message removed from a suspended account.

solemn leaf
earnest phoenix
#

it isn't a valid gif

#

that's why it isn't displaying

solemn leaf
#

Can you help me make it valid then?

earnest phoenix
#

👁️ 👄 👁️

solemn leaf
#

Is that a yes or no :|

earnest phoenix
#

that's a "your question is stupid"

#

find a valid gif

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

well

#

yes and no

#

for basic things like 2+2 sure

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.

solemn leaf
#

(await fetch("https://tenor.com/FR47.gif")).buffer()

#

thats what I ddi cry

earnest phoenix
#

go to that url

#

it takes you to the whole ass site, not the image

earnest phoenix
#

sec

#

this is a minified version of what i have in my code

eternal osprey
#

holy fuck i still can't compile my program

#

am i stupid or dumb?

shy turret
#

lol

earnest phoenix
#

nvm i can't find where my eval command is

#

i'll just give you emzi's bot

solemn leaf
#
[
    {
      gif: {
        dims: [Array],
        url: 'https://media.tenor.com/images/5980fd877fc97febfb44c0d28b5185df/tenor.gif',
        preview: 'https://media.tenor.com/images/6e426065aa7ebf7412f248a48628f56e/tenor.png',
        size: 2790087
      },
    }
]

How would I get gif?

earnest phoenix
#

take a guess

#

it's an array, then an object

solemn leaf
#

?

earnest phoenix
#

take a guess on how you would access it

solemn leaf
#

what do I do for the array

#

what is the index

earnest phoenix
#

where do indexes start from

solemn leaf
#

0

#

there is more then that

earnest phoenix
#

that's your index

solemn leaf
#

and its at random places

#

can I like search the array for it?

#

get index from that

earnest phoenix
#

there's only one element in that array

#

what are you on about

agile lance
#

lol

solemn leaf
#

what

earnest phoenix
#

you can throw out a lot of things out of that

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

like the stopwatch

#

and embeds

sage bobcat
#

One message removed from a suspended account.

quaint wasp
#
    const Embed BanEmbed = new Discord.MessageEmbed()
    .setColor("#Hex Code")
    .setTitle('Member Banned')
    .setThumbnail(member.user.displayAvatarURL())
    .addField('User Banned', member)
    .addField('Kicked by', message.author)
    .addField('Reason', reason)
    .setFooter('Time kicked', client.user.displayAvatarURL())
    .setTimestamp()

    message.channel.send(BanEmbed);

#

Why is it... underlined?

#

is it not needed?

#

nvm

#

im dumb

crimson vapor
#

Did you figure it out?

quaint wasp
#

uhh

#

yes..

#

but..

quaint wasp
#

I get this..

#
    const Embed = new Discord.MessageEmbed()
    .setColor("#FF0000")
    .setTitle('Member Banned')
    .setThumbnail(member.user.displayAvatarURL())
    .addField('User Banned', member)
    .addField('Kicked by', message.author)
    .addField('Reason', reason)
    .setFooter('Time kicked', client.user.displayAvatarURL())
    .setTimestamp()

    message.channel.send(Embed);



#

WAIT..

#

i forgot the hex code.

#

nvm

crimson vapor
#

@crimson vapor

#

Anyone have the regex for mention?

#

To check if the mention mentions the bot

glossy spoke
#
let RegMention = new RegExp(`^<@!?${client.user.id}>( |)$`);
#

@crimson vapor

solemn leaf
#
if (!buf.toString("hex").startsWith("000000206674797069736F6D")) return message.reply("That isn't a mp4!");

Why does this say that the buffer given is always not a mp4

crimson vapor
#

ty man

glossy spoke
#

Np

latent hearth
#

quick question, why does this show me "undefined" even though I play a song on Spotify and see it on my status?console.log(user.presence.activities[0]);

delicate zephyr
#

wait

#

whats the ? for in that regex

delicate zephyr
solemn leaf
#

Luke

delicate zephyr
#

mhm?

latent hearth
#

I guess not? I haven't done anything with bots for like 7months. Where do I do that?

solemn leaf
#

I need to allow anything for the first 4 characters but the rest needs to be strict how do I do?

delicate zephyr
#

should have 2 toggle switches

latent hearth
#

Ah, thank you for the help.

delicate zephyr
#

like
HEREYaydayaya
HERE - can be anything
Yaydayaya - Needs to be strict?

solemn leaf
#

Im trying to see if a buffer is a mp4

delicate zephyr
#

oh

#

hold on

solemn leaf
#

I tried

delicate zephyr
#

I have the perfect npm package for you

#

one sec

opal plank
#

im fairly certain we had this answer here before

solemn leaf
#

buf.toString("hex").startsWith("000000206674797069736F6D")

opal plank
#

yeah, that

solemn leaf
#

Im not doing an npm package

#

that doesnt work

#

bcs its offset

opal plank
#

its not that, but its a specific indlues()

#

includes()

solemn leaf
#

according to this

#

This is a list of file signatures, data used to identify or verify the content of a file. Such signatures are also known as magic numbers or Magic Bytes.
Many file formats are not intended to be read as text. If such a file is accidentally viewed as a text file, its contents will be unintelligible. However, sometimes the file signature can be re...

opal plank
#

theres a reference signature for every file

delicate zephyr
solemn leaf
#

No

delicate zephyr
#

so it'd need to be an includes

solemn leaf
#

@opal plank didnt work

delicate zephyr
#

or hell even a regex match

solemn leaf
#
if (!buf.toString("hex").includes("000000206674797069736F6D")) return message.reply("That isn't a mp4!");
delicate zephyr
#

have you tried console.log'ing buf.toString()

opal plank
quaint wasp
#

umm

#

I keep getting this:

opal plank
#

thats what they are using internally

quaint wasp
#

my code is..

#
    const Embed = new Discord.MessageEmbed()
    .setColor("#FF0000")
    .setTitle('Member Banned')
    .setThumbnail(member.user.displayAvatarURL())
    .addField('User Banned', member)
    .addField('Kicked by', message.author)
    .addField('Reason', reason)
    .setFooter('Time kicked', client.user.displayAvatarURL())
    .setTimestamp()

    message.channel.send(Embed);
delicate zephyr
#

uh

#

You didnt show uh enough

quaint wasp
#

?

delicate zephyr
#

you need to show the entire opening and closing scope

opal plank
#

this is the one you looking for i think

delicate zephyr
#

@quaint wasp You need to show the opening { and closing }

quaint wasp
#

one sec..

delicate zephyr
#

because the error is above that

quaint wasp
#
module.exports = {
  name: 'ban',
  execute: async (client, message, args) => {


    if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send('You can\'t use that!')
    if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send('I don\'t have the right permissions.')

    const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);

    if(!args[0]) return message.channel.send('Please specify a user');

    if(!member) return message.channel.send('Can\'t seem to find this user. Sorry \'bout that :/');
    if(!member.bannable) return message.channel.send('This user can\'t be banned. It is either because they are a mod/admin, or their highest role is higher than mine');

    if(member.id === message.author.id) return message.channel.send('Bruh, you can\'t ban yourself!');

    let reason = args.slice(1).join(" ");

    if(!reason) reason = 'Unspecified';

    member.ban(`${reason}`).catch(err => { 
      message.channel.send('Something went wrong')
        console.log(err)
    })



    const Embed = new Discord.MessageEmbed()
    .setColor("#FF0000")
    .setTitle('Member Banned')
    .setThumbnail(member.user.displayAvatarURL())
    .addField('User Banned', member)
    .addField('Kicked by', message.author)
    .addField('Reason', reason)
    .setFooter('Time kicked', client.user.displayAvatarURL())
    .setTimestamp()

    message.channel.send(Embed);


}
}
#

wwaaiitt...

solemn leaf
#

@opal plank doesnt really help

quaint wasp
#

Should it be on the really top?

delicate zephyr
#

no

opal plank
solemn leaf
#

I cant read that shit who you think I am

delicate zephyr
#

also Erwin

#

can you see the syntax error there?

quaint wasp
#

..?

#

no

opal plank
delicate zephyr
opal plank
delicate zephyr
#

ya

quaint wasp
#

no I cant..

#

im blind..

delicate zephyr
#

I was asking Erwin because my brain is mush rn

quaint wasp
#

oh

glossy spoke
#

What's the error you get in console??

long timber
#

CAN SOMEONE PLEASE TELL ME WHAT PROGRAM THAT IS GOD DAMIT

delicate zephyr
#

He's shown it already, its a syntax error from a missing comma or brace

opal plank
#

nothing popping off atm, theres a ton of stuff wrong as they may return undefined

#

OOH

glossy spoke
opal plank
#

its indentation

#

1 sec

umbral zealot
long timber
#

The one you use the make the bot

umbral zealot
#

Usually, a code editor, like VSCode

long timber
#

Script it

#

Okay

glossy spoke
#

Roblox is the best program to code your own bot

solemn leaf
#

Evie

glossy spoke
#

Lol

opal plank
#
module.exports = {
  name: 'ban',
  execute: async (client, message, args) => {
    if (!message.member.hasPermission('BAN_MEMBERS')) return message.channel.send("You can't use that!");
    if (!message.guild.me.hasPermission('BAN_MEMBERS'))
      return message.channel.send("I don't have the right permissions.");

    const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);

    if (!args[0]) return message.channel.send('Please specify a user');

    if (!member) return message.channel.send("Can't seem to find this user. Sorry 'bout that :/");
    if (!member.bannable)
      return message.channel.send(
        "This user can't be banned. It is either because they are a mod/admin, or their highest role is higher than mine",
      );

    if (member.id === message.author.id) return message.channel.send("Bruh, you can't ban yourself!");

    let reason = args.slice(1).join(' ');

    if (!reason) reason = 'Unspecified';

    member.ban(`${reason}`).catch(err => {
      message.channel.send('Something went wrong');
      console.log(err);
    });
    //@ts-ignore
    const Embed = new Discord.MessageEmbed()
      .setColor('#FF0000')
      .setTitle('Member Banned')
      .setThumbnail(member.user.displayAvatarURL())
      .addField('User Banned', member)
      .addField('Kicked by', message.author)
      .addField('Reason', reason)
      .setFooter('Time kicked', client.user.displayAvatarURL())
      .setTimestamp();

    message.channel.send(Embed);
  },
};```
#

nope, everything looks fine

#

indentation is fine

delicate zephyr
#

nani defuq then

#

OH

#

WAIT

solemn leaf
#

erwin

delicate zephyr
#

he isnt requiring discord

glossy spoke
#

Lmao

opal plank
#

you asked for indentation

#

:Kek:

delicate zephyr
#

Yea ik

opal plank
#

theres no syntax error

delicate zephyr
#

like i said brain mush

long timber
#

I'm looking to script a ranking bot!

opal plank
#

lmao, i was focused on the syntax

solemn leaf
#

@opal plank erwin how do I do includes for the hex

delicate zephyr
#

@quaint wasp so, have you got Discord require()'d anywhere

opal plank
# long timber I'm looking to script a ranking bot!

Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

long timber
#

Ty ty

delicate zephyr
#

like const Discord = require('discord.js')

opal plank
solemn leaf
#

I did

opal plank
#

then?

solemn leaf
#

!buf.toString("hex").includes("000000206674797069736F6D")

delicate zephyr
#

you need it in the module file too

solemn leaf
#

are you calling discord through exports?

delicate zephyr
#

you cant use an undefined variable in a new scope

#

@quaint wasp add const Discord = require('discord.js') to that command file

opal plank
#

pls dont load whole modules

glossy spoke
#

it's like using an embed that was created on another block of code

opal plank
#

import {MessageEmbed} from 'discord'

delicate zephyr
#

i was going off his code erwin

opal plank
#

xD

#

ik, just a tip

umbral zealot
#

Doesn't really matter much, it's already cached anyway so it doesn't use more memory

solemn leaf
#

erwin

delicate zephyr
#

that too

opal plank
opal plank
solemn leaf
#

isnt that what Im doing

delicate zephyr
umbral zealot
#

I don't think GC does tree shaking, but then again, I might be wrong.

opal plank
#

i havent fucked with files much at all, you should dig into that library and see whats going on behind the scenes

delicate zephyr
#

Always worth testing evie

opal plank
solemn leaf
#

evie

opal plank
#

any reason why you're so reluctant on using that package?

umbral zealot
#

I'm confused what purpose it serves to say people's names randomly.

solemn leaf
#

@opal plank it'll be slower and thats pointless if I only need to check file type once

delicate zephyr
#

He's trying to get a thing working the way he wants it and then when shown a solution told us he cant read the packages code

#

like just to take a snippet

opal plank
#

i legit sent even the line of code though

delicate zephyr
#

yea

#

i know

umbral zealot
solemn leaf
#

Evie

#

Evie

#

Erwin legit

#

I cant

#

what

opal plank
#

cool, you got to the function

#

now its calling another

#

so ctrl+click it

solemn leaf
#

you can do that in github

opal plank
solemn leaf
opal plank
#

github has a fancy thing so you can follow code

long timber
#

Omg I suck

opal plank
#

just see what it turns into

long timber
#

I failed my quiz

#

On the coding thing

solemn leaf
opal plank
#

sigh

solemn leaf
#

???

#

erwin I cant read this

#

nothing about what it does here

quaint wasp
#

ayy

#

My ban command finely worked!

delicate zephyr
#

We literally aren't allowed to just give you the answer

quaint wasp
#

oh..

#

thats spoon feeding,.

#

or at least thats what its called here.

solemn leaf
#

Im not asking for spoonfeeding at all

opal plank
delicate zephyr
#

it isn't any slower

#

trust me

#

I use it LUL

solemn leaf
#

but I legit just dont want to

opal plank
solemn leaf
#

its extra space that I dont need used

delicate zephyr
#

Wdym

#

lol

#

Like, wdym it's extra space

solemn leaf
#

npm packages use alot of space

opal plank
delicate zephyr
opal plank
long timber
#

Can someone help me with the ranking bot

long timber
#

Ty

opal plank
#

if you have a specific question, as away, but just general help implies you dont know coding at all

opal plank
# solemn leaf npm packages use alot of space

as for you, its better to not be stubborn and use that.
Doubt anyone here ever had a need to use binary to decode a buffer type. And if you can digest the code they sent there, there aint much we can do

#

since none of us ever did it before

long timber
#

@opal plank could you tell me what program we are using I'm confused like the program that we use the make the bots

opal plank
#

there isnt A program

#

theres various languages you can code in

#

read this if you want a good guide on how to make a discord bot

#

@long timber

dusky sundial
#

I feel like if you don't know what application you code in, that's a good sign to not get into discord development just yet

snow urchin
#

Property 'setName' does not exist on type 'Channel'.ts(2339)
Why am I getting this error?

dusky sundial
#

And I mean, you can use notepad to code if you really want to.

opal plank
#

theres that, but i did send them the whol learn before making a discord bot embed

umbral zealot
dusky sundial
#

Yeah, that's why I pointed it out

snow urchin
#

"684526163367952401"

umbral zealot
#

Well the question is does the code run?

#

like, does it work?

#

Because it could just be intellisence just not being able to see that the get() function returns a channel object, or not be able to load those types.

opal plank
#

also the fact that the line error is 2339 is giving me hella bad feeling about this

umbral zealot
#

that would make it a warning, not an error.

mellow kelp
#

wait i get it

opal plank
#

thats not why evie

umbral zealot
#

Nah that's a TS error code not a line number

mellow kelp
#

Channel by itself doesn't have a setName method

opal plank
#

get() may return undefined

#

thats why they error

mellow kelp
#

Channel may be a DMChannel

opal plank
#

either add a ? inline coallesence

mellow kelp
#

you can't change the name of a dmchannel

opal plank
#

or cast it

mellow kelp
#

yeah cast it

opal plank
#

if you know channel is there

#

also that

#

cast it as TextChannel

mellow kelp
#

well

#

first check if it's instanceof TextChannel

snow urchin
opal plank
#

no problomo

opal plank
mellow kelp
#

well k

opal plank
#

but nothing wrong in type guarding it

snow tendon
#

can anyone help me with this error?

#

it appears that client.get_channel isn't working

dusky sundial
#

try await client.fetch_channel(id) instead and see if that works

#

keep in mind that fetch_channel is an API call so don't spam it

earnest phoenix
#

You can't get the channel before the bot is ready because the cache is empty
You can't fetch either I think, since the session is created on static login which is called on run/start method

dusky sundial
#

Oh is he trying to do that before the bot is ready?

earnest phoenix
#

Just assuming since it returns None, they only send snippet doe

dusky sundial
pliant zodiac
#

Can i help anyhow?

snow tendon
dusky sundial
#

And where do you call that function?

snow tendon
pliant zodiac
pliant zodiac
# snow tendon

Use bot.run() and make do_something to the on_ready Event of the bot

#

It'll work

dusky sundial
# snow tendon

And you are sure the scheduler is started after the bot is ready and logged in?

snow tendon
#

I'll make sure

pliant zodiac
#

On that was you can Check it too

#

And IT would work i think

earnest phoenix
#

Is it supposed to be REST only client? If so, you could just call the static_login method directly instead of using run. Also you can just use the HTTP class instead

quaint wasp
#

How do I make a guild member count?

#

I tried message.channel.guild.memberCount

snow tendon
quaint wasp
#

But it didn't work..

snow tendon
#

oh

quaint wasp
#

?

snow tendon
#

guild member count

#

lol

quaint wasp
#

yes..

snow tendon
#

len(message.guild.members)

#

that might work

quaint wasp
#

whats len?

earnest phoenix
#

Bruh, it's not like they're using python

dusky sundial
#

The size of the collection

snow tendon
#

short for length

quaint wasp
#

Im using js..

snow tendon
#

it works now

#

thanks :)

snow tendon
#

don't mind me then

#

sorry

quaint wasp
#

oh its fine.

#

anyone who does discord.js know how to make one?

#

If its not guild.memberCount..... Then idk what it is.

earnest phoenix
#

what exactly didn't work doe?

#

Also, ig you can use message.guild instead, it's the shorthand for that

quaint wasp
#

membercount

#

?

earnest phoenix
#

memberCount think

quaint wasp
#

oh

#

So I can just type: message.guild and it will show how many members+bots are in the server?

earnest phoenix
#

no, I mean, message.guild is the shorthand for message.channel.guild

quaint wasp
#

oh...

#

Do U know how to make a MemberCount for a server?

glossy spoke
#

<message>.guild.memberCount

quaint wasp
#

in embed?

#

wait, do I put <>?

glossy spoke
#

No

quaint wasp
#

I feel like no..

#

oh

#

alr.

lyric mountain
#

Lul

glossy spoke
#

With <> i mean "Here put whatever you define as message"

#

Lmao

quaint wasp
#

oh

glossy spoke
#

m, msg, message, shitmessage

#

lol

quaint wasp
#

haha

#

..

lyric mountain
#

Just a friendly tip, I'd delay the bot development until you have some familiarity with the lang

quaint wasp
#

Why does it not know what member is on this file, but it does on the other?

lyric mountain
#

Else your path will be a reeeeally harsh one

quaint wasp
#
module.exports = {
    name: 'server-info',
    execute(client, message, args) {


        const Discord = require('discord.js')
        const Embed = new Discord.MessageEmbed()
        const counters = 'Members in this server:'
          .setColor('#27FF00')
          .setTitle('Server Infromation')
          .setThumbnail(member.server.displayAvatarURL())
          .addField(`${counters.guild.memberCount}`)
          .addField('ID:', guild.id)
          .addField(' ')
          .setFooter('Type **++help** for help! Time:', client.user.displayAvatarURL())
          .setTimestamp();
    
        message.channel.send(Embed);

    }
}```
glossy spoke
quaint wasp
#

... ?

lyric mountain
#

You don't

#

Clearly

quaint wasp
#

How do I do that??...

lyric mountain
#

But anyway, "member" doesn't exist in that scope

quaint wasp
#

const member =.... ?

earnest phoenix
#

meme

quaint wasp
#

lol

glossy spoke
#

At execute, try adding member(?

lyric mountain
#

Also, that Discord shouldn't be inside there

#

Actually you should set it in a global constant instead of creating one every time

quaint wasp
lyric mountain
#

It doesn't work like that

#

That Discord variable isn't getting one server

#

It's getting the global discord.js client

glossy spoke
#

like

const Discord = require('discord.js');
module.exports = {
//Some code
}
quaint wasp
#

ok..

lyric mountain
#

Please, learn javascript before attempting to make a bot

#

This is for your good

#

Bots aren't easy, you'll get a lot of wrong concepts

#

Or no concepts at all

#

There's no shame in starting with a Hello World program

glossy spoke
#

Imagine someone asking how to make a say command in Js lmao

dusky sundial
#

You'll only get so far by copying things from the internet. It's like trying to write an essay in a language you don't speak

mellow kelp
#

laughs in lorem ipsum

lyric mountain
#

We aren't turning you down, but you need to start from the start

dusky sundial
#

First time our web dev teacher brought that up on her website I thought she was summoning a demon

glossy spoke
#

Lmao

lyric mountain
#

If you step in a running conveyor you'll just hit the head and pass out

glossy spoke
dusky sundial
#

I think that's the reason a lot of people are discouraged from coding. They attempt some advanced project like a video game for their first thing and don't understand anything so they give up.

glossy spoke
#

I learned and understood more the language by making my bot

mellow kelp
#

i remember trying to make a game with unity with no coding experience

lyric mountain
#

There are two kinds of devs

#

Those who can use abstract imaging and those who need concrete results

dusky sundial
glossy spoke
dusky sundial
#

So is any programming language when you break it down

lyric mountain
#

The first type can learn by imagining results in the mind, thus making you learn how things work

dusky sundial
#

But if you learn one, you'll learn the others way quicker

lyric mountain
#

The second type needs to make project after project to truly understand what each thing mean

#

Both have pros and cons

quaint wasp
glossy spoke
#

And i usually try to experiment with new things without any help, and that helps me to learn by myself

lyric mountain
dusky sundial
#

The risk with self teaching is that you might teach yourself bad practices. So I do think that sometimes it can be good to learn from others

mellow kelp
#

how about documentation

#

there are some good docs out there with best practices included

dusky sundial
#

w3schools KEKW

mellow kelp
#

n0

lyric mountain
#

I'm from the first type, one of the worst cons is not being able to turn abstraction off

#

It becomes headaches sometimes

glossy spoke
lyric mountain
#

When you're almost sleeping then SUDDENLY you think about the perfect solution

#

Then u can't sleep anymore

quaint wasp
#

defined.

#

yes.

#

defined.

mellow kelp
glossy spoke
#

xd

glossy spoke
dusky sundial
#

Did y'all see that YouTube video of the 12 year old kid who apparently dreams in code?

mellow kelp
#

i mean he's smart

#

but "dreaming in code" is going way too far

quaint wasp
#

uhh... Alr. Im kinda dumb. I forgot how to fix this dumb mistake. Im such a dumbass now..

lyric mountain
#

Smug

#

Look

#

Please

quaint wasp
#

learn js?

#

ik ik ik

lyric mountain
#

Let's get real else we can't help u

glossy spoke
dusky sundial
#

I think that's the point where you're considered a psycopath more than smart lmao

lyric mountain
#

HOW MUCH u know about js?

lyric mountain
#

I need to know how to explain

dusky sundial
#

Not talking to you :)

quaint wasp
glossy spoke
quaint wasp
#

ok ok

glossy spoke
quaint wasp
#

OR 2/10

#

or even 6/10..

dusky sundial
#

Wh-

lyric mountain
#

Ok, first of all, you don't define variables capitalized in the first letter

glossy spoke
#

Reach 6 or 7 before trying to make a simple bot

lyric mountain
#

camelCase

earnest phoenix
#

convention blobweary

lyric mountain
#

Classes are defined like that

dusky sundial
#

Boi went from begginer to experienced in 5 seconds

lyric mountain
#

Second, is member supposed to represent the member that triggered the event?

quaint wasp
#

sure sure sure..

#

no..

#

message.

#

so I just had to put:

message.channel.send(member)
glossy spoke
#

Uh

lyric mountain
#

Just hardcode it then

#

Instead of spending a const

#

If u want the member count, u need to get the size of the guild members' list

quaint wasp
#

What do u mean by spending?

lyric mountain
#

Everything you declare has a cost

quaint wasp
lyric mountain
#

That's called optimization

glossy spoke
lyric mountain
#

You'll hear it a lot

#

Yeah, that

#

You used semicolon, I see you're a compiled-langs brother

glossy spoke
#

Ya

glossy spoke
#

discord.js uses advanced concepts of JS

quaint wasp
#

please.. never mind my knowledge.

opal plank
#

jesus fucking christ

#

my bot gurgling ram

glossy spoke
#

What the hell

#

Your bot is too fat bro

opal plank
#

blame d.js for that

glossy spoke
#

He's eating too much ram

drifting wedge
#

why doesnt color work on hover? background color doesnt work @ all

#
            border: #7289da 2px solid;
            background-color: #ffffff;
            color: #7289da;
            transition: ease-in-out 0.5s;
        }
        
        .entity-button--primary:hover {
            border: #7289da 2px solid;
            background-color: #7289da;
            color: #7289da;
        }```
glossy spoke
#

@opal plank bro, what's d.js saving ?

opal plank
glossy spoke
#

Your bot is too fat lmao

opal plank
#

actually, one sec

earnest phoenix
opal plank
#

same bot, same token, different libraries

#

3.3GB vs 1.2GB for 1700 servers

glossy spoke
#

u

limpid moth
#

I want to have a cooldown timer to activate only when an 'owo' is tracked, however the function does not need to be run if the cooldown is under 10 sec.

const Discord = require('discord.js');
const { list } = require('./owocommands.json');
const countcooldowns = new Discord.Collection();
module.exports = {
    name: 'count',
    execute(message) {
const msg = message.content.toLowerCase();
const afterowo = msg.slice(3).trim().split(/ +/);
// eslint-disable-next-line no-shadow
function checkCommand(list) {
    return afterowo.includes(list);
}
const thisWord = 'owo';

if (!countcooldowns.has(thisWord)) {
    countcooldowns.set(thisWord, new Discord.Collection());
}
const now = Date.now();
const timestamps = countcooldowns.get(thisWord);
const cooldownAmount = (10) * 1000;
if (timestamps.has(thisWord.message.author.id)) {
    const expirationTime = timestamps.get(thisWord) + cooldownAmount;

    if (now < expirationTime) {
        return message.channel.send('You have to wait before sending another owo!');

    }
}
// Counting code
if (msg.startsWith('owo')) {

        if (list.some(checkCommand) === true) {
            message.channel.send('That was a command.');
            timestamps.set(thisWord.message.author.id, now);
setTimeout(() => timestamps.delete(thisWord.message.author.id), cooldownAmount);

        }
        else if (list.some(checkCommand) === false) {
            message.channel.send('That was not a command');
        }


        }
        else if (message.content.includes(thisWord)) {
            message.channel.send('👍');
            timestamps.set(message.author.id, now);
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
        }
},
};
#

Sorry its a big block

opal plank
glossy spoke
#

and why are you caching all?

opal plank
delicate zephyr
#

cant you use redis to mitigate that a little bit

opal plank
#

replied to the wrong message but okay

#

memory usage would still be the same, just on redis instead

delicate zephyr
#

would it

opal plank
#

redis does a tiny bit of optimiziation

delicate zephyr
#

I was more asking why it's trippled

opal plank
#

but its not really that big

#

mainly cuz for every user, theres 3 entries loaded

#

the discord warpper user

#

a genshin user

delicate zephyr
#

Oh right,

opal plank
#

and a _cached data for third party apps

delicate zephyr
#

I was more thinking about generalising specific things

#

like making them 1 instance of something rather then storing them 3 times

opal plank
#

i wouldnt want to insert my own stuff into libraries that arent my own

#

otherwise i would unify everything under a single user object

delicate zephyr
#

yea fair

#

I guess it's not like JS

lyric mountain
delicate zephyr
#

where you can throw everything into the client object and it just works

lyric mountain
#

Lul

delicate zephyr
opal plank
delicate zephyr
#

yea

#

I make sure I read the docs before I do any of that btw

opal plank
#

USER_UPDATE or some shit would likely destroy the object

glossy spoke
delicate zephyr
#

thats

#

a memory leak on its own

#

wtf

opal plank
#

^^^^

delicate zephyr
#

it updates the obj

#

afaik

opal plank
#

does it only change the specific properties?

quartz kindle
#

ye

opal plank
#

is there NO even that would purge the data or recreate it?

quartz kindle
#

nope

#

well

#

there is one

opal plank
#

is it 100% safe to attach shit onto d.js's user object?

delicate zephyr
#

guild

quartz kindle
#

a channelUpdate event that changes a channel type from text to news

delicate zephyr
#

oh right

#

that

glossy spoke
quartz kindle
#

that's theonly thing that destroys one and creates another

delicate zephyr
quartz kindle
#

except for messages lol

opal plank
#

hmmm thats interesting, i went for the safe route

quartz kindle
#

because djs sweeps messages

limpid moth
#

Could someone help me with my cooldowns?

delicate zephyr
#

oh yea Tim

#

I was thinking

opal plank
#

also, tim, did you see what i posted before?

delicate zephyr
#

how stupid/crazy would i be to convert the Collection into a redis-cache

quartz kindle
#

about 3gb vs 1gb? yes

glossy spoke
quartz kindle
#

djs bloatware

#

scan it on virustotal

opal plank
glossy spoke
delicate zephyr
#

yea d.js is

glossy spoke
#

d.js loves eating all ram lmao

quartz kindle
delicate zephyr
#

it is though

#

I was looking into it

quartz kindle
#

you'd need to rewrite the entire djs lib into using promises for cache

opal plank
#

ported the bot, the ONLY different thing is the library, and theres a clear reduction of almost 2GB, who's to blame?

delicate zephyr
#

oh right

quartz kindle
#

you could do it with better-sqlite3 tho

delicate zephyr
#

now that would be stupid

quartz kindle
#

its less stupid than redis

delicate zephyr
#

true

opal plank
#

and guess what?

#

they were absolutely right

delicate zephyr
#

lmfao

quartz kindle
#

the problem is that it would be a pain to filter objects

#

or iterate through them

#

but for getting and setting it would be fast

opal plank
quartz kindle
#

lul

earnest phoenix
#

Is a change from d.js to Eris a good option? As you guys are saying it is bloated and just eats memory?

opal plank
#

cough cough djs-light

#

cough cough

limpid moth
#

Did I get ghkst pings?

earnest phoenix
#

😮

quartz kindle
#

:^)

delicate zephyr
#

d.js-light is a good solution until you wanna shard massively

#

(we found this out the hard way)

#

With chip

quartz kindle
#

theres no problem with sharding

#

just dont use the sharding manager

opal plank
#

i wonder if d.js or djs-light would surive someone putting a mee6 lelvel token onto it and trying spin it up

delicate zephyr
#

We used kurasuta

#

which uh

#

guess what

quartz kindle
#

kurasuta is a meme

delicate zephyr
#

yea

#

we're writing to eris-sharder

quartz kindle
#

i keep hearing about some weird af issues

opal plank
#

kubernetes™️

quartz kindle
#

like negative ratelimits

#

lmao

delicate zephyr
#

yea

#

tis uh

#

wierd

#

but still eris-sharder is cool

#

without the lack of docs ofc

lyric mountain
#

Eris-shader

quartz kindle
#

eris minecraft shader

delicate zephyr
limpid moth
#

Can someone help me with my cooldowns? sorry I'm dumb

quartz kindle
#

i heard that gateway has issues

delicate zephyr
#

like what

earnest phoenix
quartz kindle
#

idk

quartz kindle
#

just heard its buggy

#

never tried it myself

delicate zephyr
#

I tried it and it was fine

#

never had issues for what I needed it for

delicate zephyr
#

wouldnt you

opal plank
delicate zephyr
#

but after 2.5k guilds it required

#

and chip has

#

one sec lemme get the stat

earnest phoenix
#

O

opal plank
#

im already at 1700

#

visible panik

quartz kindle
#

internal sharding

#

ez

opal plank
#

frick that

delicate zephyr
#

139k

#

holy shit

#

chips about to hit 140k

glossy spoke
#

Tim, how many guilds is your bot in?

quartz kindle
#

nice

#

7.5k

opal plank
#

actually, one thing i need is to have some decent image generation into a different process

glossy spoke
#

Omg

opal plank
#

yall make me look smol

earnest phoenix
#

Meanwhile my bot is in like 3 servers 😎

quartz kindle
#

xD

opal plank
delicate zephyr
#

POG

lyric mountain
#

How much servers would I be able to handle with internal sharding?

delicate zephyr
#

uh

opal plank
#

oye

delicate zephyr
#

50k

opal plank
#

oye oye oye

#

thats really dope

#

teach

lyric mountain
#

Cool

delicate zephyr
#

50k on internal

#

atleast for chip

opal plank
#

oye oye oye

#

luke

#

teach

glossy spoke
delicate zephyr
#

wdym Erwin

opal plank
opal plank
delicate zephyr
#

I didnt make that

glossy spoke
opal plank
#

never played with that

delicate zephyr
#

Kyoso did

quartz kindle
#

internal sharding is as good as a single cpu core can handle

delicate zephyr
opal plank
#

@twilit rapids teach

delicate zephyr
#

he is asleep

glossy spoke
#

teach what

opal plank
delicate zephyr
#

its 4am for him

opal plank
delicate zephyr
#

iirc Erwin

#

he just checks the amount of servers - a set value you give

glossy spoke
#

You speak it as a latam

#

Lmao

delicate zephyr
#

and then does it that way based on a derivative

opal plank
delicate zephyr
glossy spoke
#

i'm still learning english mmLol

delicate zephyr
opal plank
glossy spoke
#

What's that?

opal plank
#

my dashboard

delicate zephyr
#

Grafana

glossy spoke
#

o

earnest phoenix
#

That looks

#

Advanced

opal plank
#

let me check that rq

#

cuz it is

delicate zephyr
#

@opal plank ngl I'm gonna need you to set mine up when I set my bot up

#

because thats gonna be fun

opal plank
delicate zephyr
#

Yea I might just need you to send me the JSON for it

#

so I can just yoink the panels and shit

#

if you're willing ofc

earnest phoenix
#

What's your bot about Erwin?

opal plank
#

ngl, its not nearly as modular as you think lmao

#

@earnest phoenix click my pfp

delicate zephyr
#

everything is modular even if it means using a jank solut

opal plank
#

the issue is, its not conteinarized at all, so setting it up is a pain

delicate zephyr
#

Oh

#

right

opal plank
#

though you could very well scrape a bunch of what im doing

#

though most of it i dont think you'd be able to scratch

delicate zephyr
#

I wanna setup a decentralised API for it

#

because uh

#

having the bot post directly to influx is pain

#

when its just "NO DATA"

opal plank
#

most of it is handled internally on the bot too

delicate zephyr
#

it annoys me

#

Decentralise EVERYTHING mmulu

#

micro services and shit

opal plank
#

thats whats going on rn

glossy spoke
#

EasyDB is better than SQLite 😎 👌

delicate zephyr
#

I also realised something

opal plank
#

prometheus runs one, the bot runs a bunch of others, elk grabs a couple, posgres graps some more metrics, theres shit everywhere

delicate zephyr
#

you know how you need to have identified in the last i think its like hour in order to send a message

opal plank
#

its not all being pulled from one place

delicate zephyr
#

iirc it is

opal plank
#

never tried posting in postman with my token

delicate zephyr
#

Atleast I know you cant send messages without being identified in the last X

#

from the docs

#

i cant remember though

opal plank
#

not sure tbh, like i mentioned, never even attempted that

delicate zephyr
#

discord.dev time

#

yea

#

there we go

#

I dont know the time limit though

#

jerry rigging time

opal plank
#

trying to find the button

delicate zephyr
opal plank
#

ah fuond it

delicate zephyr
#

oh oof

opal plank
#

oooooh fancy

delicate zephyr
#

im about to try shutting the bot down and see if I can still send messages

#

if I can

#

then my theory is right

#

oh ffs

#

how do I stop this shit

#

@opal plank any idea?

drifting wedge
#

on hover

#

and the background color cant be changed?

opal plank
#

bruuh

#

why

#

you cant move buttons around

#

trash

#

spit

delicate zephyr
#

Idk why its forbidding me

#

oh wait

#

is it because no-js

#

yes

#

yes it is

#

cloudflare pls

opal plank
#

okay im done with the panel

#

fuck that

#

imma have to make a new dashboard for that crap

#

no thanks

#

bye bye test panel

#

imagine not allowing buttons to be moved

#

spit know your place trash

delicate zephyr
#

why do you think kyoso made its own panel

opal plank
#

imagine

#

having a specific panel

#

for a query

#

reeeee

delicate zephyr
#

ikr

opal plank
#

it should be easy too

delicate zephyr
#

grafana make me screee

opal plank
#
$__tohuman( (server-label) / rate(growth) )
#

that should give the exatc same thing you got there

#

get the difference between the label input vs the server count

#

and then divide by the current growth

delicate zephyr
#

you know what you could do

#

to be fancy

opal plank
#

sup

delicate zephyr
#

set the label through your bot

#

so you dont need your own panel

opal plank
#

hmmmmm

#

hmmmmmmmmmmmmmmmmmmmmm

#

hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

delicate zephyr
#

means learning the grafana api

#

BUT

opal plank
#

very interesting idea

delicate zephyr
#

Actually

#

it wouldnt

#

you can just make it send a constant value

opal plank
#

i dont need it, i got logs

#

the same way im fetching from grafana, i can fetch from the bot

#

and calculate the rate again

delicate zephyr
#

Yea

opal plank
#

:ASthink:

#

FUCKING

delicate zephyr
#

mmulu go be smort

opal plank
#

1 sec

#

let me reload my client

#

i hate when you lose nitro you can still send emojis

#

but they turn into that

#

ffs

#

there we go

delicate zephyr
#

am I acutally gonna have to write a fetch in js

#

just so I can fucking

#

test this theory

#

I get 403 from fucking cloudflare everytime

opal plank
#

lmao

delicate zephyr
#

Oh

opal plank
#

axios™️

delicate zephyr
#

COOKIES ARENT ENABLED

quartz kindle
#

kukis

opal plank
#

cooks

quartz kindle
#

you know what

earnest phoenix
#

Accept them

quartz kindle
earnest phoenix
#

Or DIEEE

quartz kindle
#

everytime my bot gets front page, it gains 400 servers

#

but they're all shit servers

delicate zephyr
#

POG

quartz kindle
#

this from reqbin?

delicate zephyr
#

wdym

quartz kindle
#

but i guess not

#

the UI is slightly different

delicate zephyr
#

nah im using postman

#

ok discord

limpid moth
#

Do collections last over restarts?

delicate zephyr
quartz kindle
#

exdee

limpid moth
#

Or are they maps so no?

quartz kindle
limpid moth
#

ok

#

It doesn't matter when using for cooldowns I just wanted to check ty

delicate zephyr
#

@opal plank you have until the time your presence is wiped until you cant sent messages again

#

so you can send messages when you bot is "offline"

#

So yea technically it'd be fine to make a microservice for reminders

#

ok pog

quartz kindle
#

what are you testing?

delicate zephyr
#

if you could send messages when not connected to the gateway

quartz kindle
#

ah