#development

1 messages · Page 1549 of 1

cinder patio
#

So, if you want to set the initial state, use constructor. If you want to call any async functions, use componentDidMount

tribal siren
#

How to do online mobile presence status?

rustic nova
tribal siren
#

i can't see mobile online here

summer torrent
#

change browser in ws settings

opal plank
#

Would not recommend doing that

#

@Brace#6565

#

Its not documented feature, avoid using it

#

Against tos to use it

tribal siren
#

oh is it

opal plank
#

It isnt documented

#

Against tos

tribal siren
#

just my friend has two verified bots with online mobile and im like you know what hey i wanna do that too

opal plank
#

I know how to do it, and the "my friend has it" excuse doesnt fly by

summer torrent
tribal siren
#

aight thanks

#

so it's against tos you say?

opal plank
summer torrent
#

yeah

tribal siren
#

oof

opal plank
#

it doesnt list anywhere about mobile status

#

hence why i said it shouldnt be used

quartz kindle
#

if people wanna do it let them do it

summer torrent
#

^

opal plank
#

fair point, but it still worth mentioning that it isnt a good thing to do

quartz kindle
#

90% chance nothing will happen
9% chance discord will warn about it if they ever decide they dont want to allow it
1% chance they will actually ban for it

opal plank
#

is it worth the risk for a simple svg?

lusty quest
#

if they would enforce this stuff seriously it would be stupid and unnecessary load on the staff

opal plank
#

i absolutely doubt anything will happen too

lusty quest
#

if they get a report in sure they maybe have a look

summer torrent
#

oh erwin is notable member too, congrats

opal plank
#

ty

lusty quest
#

did you got a Dev License for settings the custom Status?

quartz kindle
#

@summer torrent im trying to make sense of your nickname... Nordon Greeman -> Gordon Nreeman?

opal plank
#

SDK is publically and openly available

summer torrent
#

wait wtf

#

lmao

#

*Fordon

quartz kindle
#

lmao

lusty quest
#

nice would love to do something useful while having called in sick at work. but the reason i cant work is a inflammation on a finger that my doc opened this morning and now i have a bandage around the finger, causing me to fatfinger everything

quartz kindle
#

lmao rip

opal plank
#

fat rip

quartz kindle
#

which finger?

lusty quest
#

middle finger

#

on my dominant hand

quartz kindle
#

practice typing without it

opal plank
#

just ype with ur feet

#

duh

lusty quest
#

it took me years to train writing with 10 fingers

misty sigil
#

just untrain one finger and retrain it la’ah

quartz kindle
#

you actually type with 10 fingers?

#

i hardly ever use 8

opal plank
#

^^

quartz kindle
#

i mostly just use 6

opal plank
#

having all fingers on keyboard is weird af

misty sigil
#

ikr

lusty quest
#

yea used to do, got forced into it back in school. instead learning stuff like HTML we got foced to learn how to write with 10 fingers. now i write with 6

opal plank
#

5*

lusty quest
#

maybe 7

quartz kindle
#

shitty outdated schooling methods smh

lusty quest
#

i know

#

the guys who where 2 classes lower learned HTML and CSS

opal plank
#

imagine schools where people were forced to be right handed

quartz kindle
#

rip

lusty quest
#

well

#

there where some stuff in elementary school

#

not me luckly

opal plank
#

sounds like the same sort of thing where it plays 0 role on what you do, exactly the same as using 10 fingers. If you prefer using 1 finger at a time, and still do the job, its completely up to you

#

seems like a completely waste of teachers and students time and money(if you paid for school)

lusty quest
#

well yea. but they changed a lot recently, partially to the worse

opal plank
#

big f then

lusty quest
#

also i guess we become a bit offtopic

opal plank
#

fair

lusty quest
#

anyways, need to get motivation to finish my dashboard.

zenith terrace
#

you can do it!

quartz kindle
#

im gonna make a node.js hashing benchmark repo

zenith terrace
#

FINISH IT

quartz kindle
#

because im addicted to benchmarks

zenith terrace
#

hi tim

quartz kindle
#

hai :3

zenith terrace
#

hows development

quartz kindle
#

its gonna be a pain, because there are like 100+ hashing libs

#

some 10 years old

misty sigil
#

some just made

quartz kindle
misty sigil
#

my development is the opposite

quartz kindle
#

im working on FTSet v2, and rewriting some parts of my bot

#

then i need to finish the c++ lib

#

but all i can think about is "which hashing lib is faster in nodejs"

zenith terrace
#

google

quartz kindle
#

already did

lusty quest
#

write a hashing lib with c++ backend for node

quartz kindle
#

^ bad results

#

when it comes for very simple operations, pure-js will win against any native code

lusty quest
#

then just write the world fastest hashing lib

quartz kindle
#

because the overhead of context switching between the js engine and other langs is bigger than the computational advantages

lusty quest
#

yea you are right

quartz kindle
#

i tested some wasm libs as well

#

the overall fastest hashing lib in js is the DJB2 family

zenith terrace
#

on google

quartz kindle
#

also, there are many different purposes for hashing, plus crypto vs non-crypto hashing

lusty quest
#

if i would start caring for how fast my bot executes code i probably could pick the bot and put it into a recycle bin and then start over

quartz kindle
#

lmao

#

its not for my bot

#

(although i did switch levenshtein libs in my bot for a faster one)

#

im adding indexing to FTSet

#

i already chose a hashing method, but i like benchmarks so i wanna make a big ass bench

zenith terrace
#

idk

#

I looked up hashing on gifs

quartz kindle
#

lmao

opal plank
quartz kindle
#

Lol

fluid basin
quartz kindle
#

normal hashes for indexing keys

fluid basin
#

oh that

#

md5 is pretty good

#

mongo uses that internally

quartz kindle
#

but since im here im gonna throw in crypto as well for performance comparison lul

crimson vapor
#

Tim are you doing more tests?

quartz kindle
#

im always doing tests lul

#

always wasting my time with tests

rocky hearth
#
const app = require('express')();
const http = require('http').createServer(app); 
const io = require('socket.io')(http);

app.get('/', (req, res) => {
  res.sendFile(__dirname + '/index.html');
});

io.on('connection', (socket) => {
  console.log('a user connected');
});

http.listen(3000, () => {
  console.log('listening on *:3000');
});

When we createServer() with app. Can the argument also be, any router? On 2nd line

lusty quest
#

idk if it would satisfy tim but make benchmarks in rust. iirc rust is pretty much the fasts compiled language after C

quartz kindle
#

the argument can be a thing that contains replacement classes for all of the above

quartz kindle
lusty quest
#

eventually you will run out of stuff to benchmark

quartz kindle
#

for example, the fastest hashing family around at the moment is xxHash

#

but in node its not actually that fast

#

simpler things like DJB2 and FNV are much faster in node

#

in exchange for lower entropy and higher collision rate of course

#

plus the problem is not even which family or algorithm is the fastest

#

the problem is also which specific library or implementation does it better

#

there are countless libs on npm that implement the same thing lol

rocky hearth
#

So if I do this, will it work?

const app = express(), gameRouter = express.Router();
app.use('/game', gameRouter);
const io = socketIO(http.createServer(gameRouter));
lusty quest
#

yea but with different flavours, Mongoose is easyer than MongoDB but mongodb is faster bcs of different way to validate the data

quartz kindle
#

not in this case

#

all these hashing libs do exactly the same thing, just the internals are different

lusty quest
#

yikes

quartz kindle
#

some use c++, others use wasm, others use ts, others pure js

#

but the algo itself is the same

#

jesus just search for "md5" on npm and you get dozens of libs

vapid lagoon
#
@client.event
async def on_dbl_vote(data):
    print(data)

How To Get User ID From This Data I Should Use data.user or what ?

tribal siren
#

await client.channels.cache.get('803965153183399998').send('s')

cinder patio
#

where is the code located?

#

How many instances of the bot do you have running?

tribal siren
#
const Discord = require('discord.js');

const client = new Discord.Client();

client.on('ready', async () => {
  client.user.setActivity('s', {type: 'WATCHING'})
});

client.on('message', async message => {
  if(message.content === 's'){
    await client.channels.cache.get('803965153183399998').send('s')
  }
});

client.login('no')```
#

this is the code

#

the bot is fresh new

cinder patio
#

remove the token

#

refresh it

rocky hearth
#

if(message.author.bot) return;

tribal siren
#

done

cinder patio
#

You don't check if a bot sends a message. So your bot triggers itself

#

you get only 5 messages thanks to the discord.js ratelimit handling

tribal siren
#

thanks

#

thank you

#

(This)[Link] doesn't seem to work

regal saddle
delicate shore
#

I wanna check if link ends with .mp4

#

How can I?

earnest phoenix
#

endsWith?

pale vessel
#

link . endsWith ( "mp4" )

#

wew

delicate shore
#

nah

#

doesnt work

#

I tried

#
if("imgur.com/a/3odsbf.mp4".substr(-3) === "mp4" ) {
msg.channel.send("h")
}
#

this worked tho

cinder patio
#

thonkku .endsWith should work

#

maybe you didn't do something properly

earnest phoenix
#

tonc

tribal siren
#

.endsWith is supposed to work

#

f.split('.').pop() === 'mp4'

#

this could also work

earnest phoenix
rocky hearth
cinder patio
#

should work, though I've never worked with socketIO

#

wait

#

I think it should be createServer(app) instead of gameRouter

rocky hearth
#

yes, thats what I want to know. If it'll work with routers or not?

cinder patio
#

like, if the createServer function will work if you pass a router?

#

Probably not, but you should try anyways

shy yew
#

how do you outline text in html (it's for my bot)

earnest phoenix
#

unepic

opal plank
#

@slender thistle

cinder patio
#

@green kestrel

opal plank
#

nono, ping shiv

slender thistle
#

Right

opal plank
#

straight to the voind

slender thistle
#

@earnest phoenix Could you not post big empty message please thank you

earnest phoenix
#

Hi, what would be a good data type for command configs. I'm planning to store things like ignored roles and channels for each command. I'm using mongodb.

quartz kindle
summer torrent
#

what is this

quartz kindle
#

this is why benchmarks are important

cinder patio
#

yikes

summer torrent
#

lol

quartz kindle
#

for big strings or files, node's built in crypto module is the best

opal plank
#

it has ts, of course its the best

pale vessel
opal plank
pale vessel
#

kek

#

i should learn ts honestly

lusty quest
#

what are the benefits of TS over js?

pale vessel
#

i'm currently learning react

opal plank
#

everything

quartz kindle
#

this is all for MD5 only

#

kill me

opal plank
#

Ts is js but better

lusty quest
#

this is not a reason its a opinion

opal plank
summer torrent
opal plank
#

no, it ACTUALLY has some of the most helpful things you can find

opal plank
#

transpiling code to different node versions, catching bugs before you even compile/run code, type assurance, intellinsece, integrated wiki, it has everything

lusty quest
#

give me numbers, why should i use TS over JS, are there benefits outside of a bit different user interaction

quartz kindle
#

^ none

opal plank
#

i sent u a video that quickly explains it

quartz kindle
#

lmao

cinder patio
#

Integrated react parser

opal plank
#

you're none tim

cinder patio
#

bye bye babel

opal plank
#

fuck bable, welcome tsc

quartz kindle
#

ts is not faster than js, it just does better js for you

#

if you do good js, then ts wont be faster

#

if you do bad js, then ts will be faster

cinder patio
#

Not exactly

opal plank
#

ts has way too many handy features that doesnt include transpiling code

#

also ts is quite smart when it comes to transpilation

#

apart from compiling time vs actual run time inside code, i would not think its much slower

cinder patio
#

yeah, ts can transpile your code in a way that makes it more predictable

#

for the interpreter

quartz kindle
#

ts could in theory do microoptiizations for you

lusty quest
#

i think i still keep learning rust over TS

quartz kindle
#

for example transpile array methods into for loops

#

but i dont think it does that

earnest phoenix
#

you'll get experimental ecma features in ts

cinder patio
#

decorators

tribal siren
#

@quartz kindle gg on notable member

quartz kindle
#

ty

opal plank
#

imagine having notable member

#

lul

tribal siren
#

lul

#

agree

#

who even doesn't have it

opal plank
#

whitename forever

earnest phoenix
#

i believe in whitename supremacy

tribal siren
#

what can a notable member do

opal plank
#

though cry made a good point, having experimental features before they even get added to node is quite handy

#

ts implements them before they are out in node, so you can have some really nice stuff

cinder patio
opal plank
#

like conditional chaining before node even got it

tribal siren
opal plank
#

ts is notorious for adding some handy shit before node

#

road to 50k

summer torrent
lusty quest
#

im on the road to 15k nice

tribal siren
#

1.2k messages noice

opal plank
#

funfact

tribal siren
#

insert fun fact here

opal plank
lusty quest
#

i think my got Bot a command for a funfact

tribal siren
#

oh man

#

oh maaaaaaan

lusty quest
#

dont lookup tim then

earnest phoenix
#

95% of my messages are in dev

cinder patio
#

same

pale vessel
#

you haven't talked in testing in years lmfao

quartz kindle
#

same

green kestrel
#

was I pinged here?

earnest phoenix
#

there was a wallspam

restive furnace
knotty quartz
#

What topic is this

summer acorn
#

no one:
me in a single of js:

                    embed.addField(upgrade.name, `${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]+1] ? `*Tier**:  ${roman.toRoman(user.renownUpgrades[upgrade.name.toLowerCase()]+1)}\N**Cost**: ${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]+1].cost} renown\n**Power**: ${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]+1].power}\n\n**${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]+1].required > user.prestige ? `You need at least prestige ${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]+1].required} to purchase this.` : `${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]+1].cost > user.renown ? `You need ${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]+1].cost-user.renown} more renown to upgrade this.` : `Do \`-renown ${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]+1].name.toLowerCase()}\` to upgrade this`}`}**\n\n**Current Tier**: ${user.renownUpgrades[upgrade.name.toLowerCase()]}\n**Current Power**: ${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]].power}` : `**Maxed**\n\n**Current Tier**: ${user.renownUpgrades[upgrade.name.toLowerCase()]}\n**Current Power**: ${upgrade[user.renownUpgrades[upgrade.name.toLowerCase()]].power}`}`);
earnest phoenix
#

help please this error
let user = message.mentions.users.first() || client.users.cache.get(message.content.split(' ')[1])
^
TypeError: Cannot read property 'get' of undefine

cinder patio
#

What version of discord.js are you using

earnest phoenix
#

12

cinder patio
#

you sure? client.users.cache shouldn't be undefined then

summer acorn
#

try console logging typeof client.users.cache

#

to see if it really exists

#

and if you are using v12

marble juniper
#

related to tensorflow.js
does it make more sense to have more cpu cores or a higher clock rate

earnest phoenix
#

message.author.avatarURL V11

#

message.author.avatarURL() V12

summer acorn
#

kekw

#

they didn't even use either

rocky hearth
#

whr rust is used in webdev?

summer acorn
#

they used avatarURl

#

lowercase L kekw

marble juniper
#

L

earnest phoenix
#
client.on('message', message => {
  
  let user = message.mentions.users.first() || client.users.get(message.content.split(' ')[1])
  if (message.content.startsWith(prefix + 'unban')) {
    if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send(':x:|**\`You dont have administrator permission`**');
    if (!user) return message.channel.send(`Do this ${prefix} <@ID user> \n or \n ${prefix}unban ID user`);
    message.guild.members.unban(user);
    message.guild.owner.send(`The User has been unbanned \n ${user} \n By : <@${message.author.id}>`)
    var embed = new Discord.MessageEmbed()
      .setThumbnail(message.author.avatarURl)
      .setColor("RANDOM")
      .setTitle('**●Unban** !')
      .addField('**●User Unban :** ', `${user}`, true)
      .addField('**●By :**', ` <@${message.author.id}> `, true)
      .setAuthor(message.guild.name)
    message.channel.send(embed)
  }
});

#

i fix problem

#

when i type t!unban ANd id user

#

it still say Do this t! <@ID user>
or
t!unban ID user

#

i mention him and i type his id and still nothing

lusty quest
earnest phoenix
#

and use message.author.avatarURL()

marble juniper
#

default backend

delicate shore
#

Hello

#

tensorflow doesn't support node 14

marble juniper
#

bruh

#

i use v15

delicate shore
#

tensorflow@node-tfs or smth

#

doesn't support v14

marble juniper
#

then why I can use it

delicate shore
#

you are god

lusty quest
#

i also run node 14 with tensorflow.js lol

marble juniper
#

true

#

it does support it

#

what are you talking about

#

u looked at some page from 2017 or something

delicate shore
#

I-

opal plank
#

you ever figure out how to patch a major problem in your code, and them simply forgot to go and do it? mmulu

#

i legit spent 3h trying to figure out the mem leak, found one of them, and then forgot to patch it

#

tru dev

delicate shore
#

<@&802585422109736980> what does this role mean

opal plank
#

that we are notable members

delicate shore
#

;-;

opal plank
#

people who are actively helping out

delicate shore
#

ohh

#

Damn

opal plank
#

hence why @quartz kindle for example has it

delicate shore
#

:salute:

#

;-;

sacred trout
#

from DecoraterBotUtils.utils import *

opal plank
#

hmmm i wonder how the heck imma implement this

lusty quest
delicate shore
#

It kinda is because when I tried it on node v12 it worked
When i tried with yarn on v14 it said not compaitable

lusty quest
#

i just installed with npm and it worked

marble juniper
#

so anyways

#

do I just need cpu speed or cpu cores

lusty quest
#

Speed

marble juniper
#

I do have a self made tensorflow.js api

earnest phoenix
#

i change old code
and i change to this
But still same problem help please

lusty quest
#

node is singlethreaded

marble juniper
#

that runs in cluster

lusty quest
#

if you can run it on a Worker cluster get more cores

earnest phoenix
#
client.on('message', msg => {
    var error = "❌";
    var success = "✅";
    var lodeing = "🤔";
    var user = msg.mentions.users.first() || client.users.cache.get(msg.content.split(' ')[1])
    if (msg.author.bot) return;
    if (msg.channel.type == "dm") return msg.channel.send(new Discord.MessageEmbed().setTitle(error + " **You Can't Use This Command In DM!**"));
    if (msg.content.startsWith(prefix + 'unban')) {
        if (!msg.guild.me.hasPermission('BAN_MEMBERS')) return msg.channel.send(new Discord.MessageEmbed().setTitle(error + " **I Can't Bannd Any Member In This Server Becuse I Don't Have `BAN_MEMBERS` Permission!**"));
        if (!msg.member.hasPermission('BAN_MEMBERS')) return msg.channel.send(new Discord.MessageEmbed().setTitle(error + " **You Need `BAN_MEMBERS` Permission To Use This Command!**"));
        if (!user) return msg.channel.send(new Discord.MessageEmbed().setTitle(error + " **Please Type User Id !**"));
        msg.guild.members.unban(user);
        msg.guild.owner.send(success + `This User <@!${user}> Has Ben Unbanned By <@!${msg.author.id}>`)
        msg.channel.send(lodeing + " Processing The Unban Function...")
        msg.channel.send(success + `This User <@!${user}> Has Ben Unbanned By <@!${msg.author.id}>`)


marble juniper
#

lol

lusty quest
#

arent those Node Workers?

marble juniper
earnest phoenix
#

he say please type id

delicate shore
#

oh

lusty quest
# marble juniper yes

if you manage to run them on mutiple threads go for more cores, if you can get both speed and cores its even better

sacred trout
#
class NSFW:

    def __init__(self):
        self.image = None
        self.nsfw_text = PluginTextReader(
            file='nsfw.json')```
earnest phoenix
delicate shore
lusty quest
#

but from my switch from a 1.2GHz VPS to a 3.6Ghz Root server i found that it is faster and with less impact on a faster CPU

delicate shore
#

so it's easier for all of us

earnest phoenix
lusty quest
#

if you can get something like a Ryzen 3600 it will work perfectly i guess

#

even better if you could get a Dedicated GPU for it

marble juniper
#

cpu would have 4ghz 8 cores

#

lol

#

would run in docker

lusty quest
#

would be good.

earnest phoenix
lusty quest
#

like i said i had some great improvement while running it on a faster CPU

marble juniper
#

when I ran it on my gaming pc I had a 30ms time to scan a single image

#

lol

#

on my vps 300ms

lusty quest
#

on my Single Core VPS i reached 70-80% Utilisation for Text Classification.
on my new Server i had barely even 1% Usage

#

also on your PC its probably GPU acclerated or did you not used it?

delicate shore
lusty quest
#

then you probably could get down to 10ms

delicate shore
#

you can do something like this -

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

Something like this probably

#

then do const user = message.mentions.member.first() || args[0]

marble juniper
delicate shore
#

what is happening to me

marble juniper
#

my cpu usage is very high often

#

lol

lusty quest
uncut night
#

i cant download discordjsopus

marble juniper
#

even on my pc

lusty quest
#

also for image Classification i suggest to use a GPU

marble juniper
#

it always reaches 100% utilization

uncut night
marble juniper
lusty quest
#

i know

marble juniper
#

kekw I can't even use a gpu with what im using

#

it just errors

lusty quest
#

would be cheaper if you buy a older Server from Ebay and add a GPU something like a Quadro P2000

lusty quest
lyric mountain
#

cpu steal time

lusty quest
#

idk

marble juniper
#

build my own server or what

lusty quest
#

less than a second

lyric mountain
#

it's the thing that 99% the times make your cpu usage go over the roof

delicate shore
#

help

lyric mountain
#

if your vps has noisy neighbours it can be the cause of it

lusty quest
lusty quest
lyric mountain
#

nice

#

my vps used to suffer from high st during 17:00h to 20:00h

#

during that time my ping jumped from ~50ms to ~9000

lusty quest
#

well either pay more for a dedicated core or get a cheap Dedicated Server

#

cheapest one ive ever had where 20€/Month

#

but with shitty support and a dead Harddrive

marble juniper
#

I can get a dedi but it wouldn't have a gpu

#

it would have good cpu power though

#

like 4ghz 8 cores

#

my pc has 4.2ghz 6 cores

#

lol

lusty quest
#

server is just a suggestion.

#

if you done rent into a Datacenter with a good contract

#

i bet over a span of 2 years its cheaper

marble juniper
#

true

lusty quest
#

i saw people getting pretty decent servers for less than 300$ from Craigslist too, but its more a hit or miss

marble juniper
#

but Im not even able to use a gpu in my code

#

cuz reasons

#

lol

lusty quest
#

why? i know that you can enable GPU accleration for Cuda Cores

marble juniper
#

tensorflow doesn't let me

#

it screams when it is a different backend

lusty quest
#

lol

#

did you got a Nvdia GPU?

opal plank
#

wtf?

marble juniper
#

no

opal plank
cinder patio
#

You cannot convert an object which references itself to JSON

opal plank
#

wait what? legit?

cinder patio
#

yes

#

it would create an infinite object

opal plank
#

now where the fuck this even coming from

lusty quest
# marble juniper no

Tensorflow only likes Nvdia GPUs bcs of Cuda Cores, for amd i think there is a annoying way around

lyric mountain
#

it'd be like

user: {
  id: 1234,
  user: {
    id: 1234,
    user: {
      id: 1234,
      user: ...
    }
  }
}
marble juniper
#

and will error if its not

lusty quest
#

i think you have to install the c++ backend then

marble juniper
#

ig

lusty quest
#

will also improve the performance of tf

marble juniper
#

ig

#

how is the backend called

#

how do I get it

#

lol

lusty quest
#

when i installed tf it yelled at me install the c++ backend

#

but i guess i run a bit different tf impmlementation

#

@tensorflow/tfjs-node is the c++ backend for me

opal plank
#

@cinder patio i think i narrowed it down to what is causing it

#

but it still bothers me that this was working before

#

but not anymore

lusty quest
#

and this one for GPU accleration @tensorflow/tfjs-node-gpu

opal plank
#

this is likely the culprit, cuz that lib is already error'ing, but i have no idea how to fix this

#

Agent() should be a constructor

#

so im not sure why its error'ing with that

marble juniper
cinder patio
#

ew axios

#

use node-fetch

opal plank
#

hell naw

#

fuck that shit

marble juniper
#

use axios

opal plank
#

axios handles most of the stuff for me

marble juniper
#

axios good

#

node fetch is just a wrapper around the fetch function

opal plank
#

i am SO confused rn

lusty quest
opal plank
#

this works but not the original

marble juniper
knotty quartz
#

hi can I put code here and get help

opal plank
knotty quartz
#

I got the code just it a error with connecting it

opal plank
#

what error you get?

knotty quartz
#

Braces wrong but when i correct them it says unexcpected error

#

Ill send the code

#

But i added it and it says unexpected

marble juniper
#

why is that code so ugly

#

also you don't use break in ur switch statement

#

also please use a formatter

cinder patio
lyric mountain
#

also, I see where that goes so I'll say for once: Don't use switch-case for commands

marble juniper
lyric mountain
#

it's rough, it's coarse and it gets everywhere

#

use command managers

lusty quest
marble juniper
#

don't use a single file in the first place

#

it gets uglier overtime

quartz kindle
#

i think i have one around let me check

knotty quartz
#

Ill format it after

marble juniper
#

you are missing a break again

pale vessel
#

No do it now

marble juniper
#

at the end

#

also

lyric mountain
#

all cases must have a break

#

except default

marble juniper
#

please format it for the love of good

#

*god

knotty quartz
#

COnfused

knotty quartz
lyric mountain
#
switch                       (variable)
{
      case    "Hi":            message.channel.     send("Blabla"); break;
              }
``` is bad
#
switch(variable) {
  case "Hi": 
    message.channel.send("Blabla");
    break;
}
``` is good
#

it's far easier to find errors in a properly formatted code

quartz kindle
#

@lyric mountain @opal plank ```js
function replacer() {
const seen = new WeakSet();
return (_, value) => {
if(typeof value === "object" && value !== null) {
if(seen.has(value)) { return; }
seen.add(value);
}
return value;
};
}

JSON.stringify(myobj, replacer)

knotty quartz
lyric mountain
#

how does it represent the self-reference?

summer torrent
#

is WeakSet new

lyric mountain
marble juniper
#

format the code

knotty quartz
#

how

marble juniper
#

it just makes ur life harder in the end

lyric mountain
#

tabs

quartz kindle
lyric mountain
#

spaces

marble juniper
#

remove the code thats there

#

and paste in ur own

#

and boom its formatted

quartz kindle
lyric mountain
#

cool

knotty quartz
lyric mountain
#

see, there's the error

#

you missed a }

pale vessel
#

What event is that

knotty quartz
#

where

lyric mountain
#

after the last line

knotty quartz
#

Now how do I get it to respond

#

@lyric mountain

lyric mountain
#

you need to handle messages inside a message event

#

like this

#

note the "client.on('message') line"

knotty quartz
#

client.on('message',)

pale vessel
#

Use only one message event please

knotty quartz
#

@lyric mountain I added the message event is there something I need to add onto it for it to reply?

lyric mountain
#

the message handling

#

adding only the event means the bot will do what's inside it on every message sent

knotty quartz
#

client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('pong');

so i change it to hi

lyric mountain
#

on a very basic level, yes

knotty quartz
#

to every command or on

solemn leaf
#

I need helps with regex

#

Im tyring to get the text between two qoutes

lyric mountain
solemn leaf
#

ok

#

how

#

there is two things on this page

knotty quartz
#

it didnt work

#

@lyric mountain

solemn leaf
#

all I learned is this and it prob dont work

#

^\"\""\""$

lyric mountain
#

^\".+\"$

#

regexr shows what each thing means

lyric mountain
knotty quartz
quartz kindle
#

read the example code again

#

carefully

solemn leaf
#

How do I use regex

knotty quartz
#

client.on('message', msg => {
if (msg.content === 'hi') {
msg.reply('test');
}
});

solemn leaf
#

do I put it in a match

quartz kindle
#

depends, what do you want to do with it?

lyric mountain
knotty quartz
#

So how to do that?

#

@lyric mountain

knotty quartz
#

Like client.on('message', msg => {
if (msg.content === 'hi') {
msg.reply('pong');
}
});

lyric mountain
#

do you know how JS works?

knotty quartz
#

And that repleaces case

knotty quartz
lyric mountain
#

"your database on your bot" what?

knotty quartz
#

Its a different script

solemn leaf
#

would .match return an arry

quartz kindle
#

moving on to testing crc hashes

#

pls stop making libs that do the SAME THING

solemn leaf
#

is-odd

umbral zealot
#

is-not-even

knotty quartz
#

@lyric mountain
client.on('message', msg => {
if (msg.content === 'hi') {
msg.reply('test');
}
});
switch (variable) {
case 'hi':
message.channel.send("Test");
}
}
)

#

like that

solemn leaf
quartz kindle
#

if you dont know js just say so @knotty quartz

umbral zealot
#

No that would be is-even. 😂

solemn leaf
#

wai

#

no

#

is-not-odd

#

require is-odd

#

then flips it

quartz kindle
#

is-is-odd

umbral zealot
#

point is there's a lot of npm cancer out there

quartz kindle
#

to check if the function is the is-odd function

knotty quartz
solemn leaf
#

so how do I use regex exactly

quartz kindle
#

¯_(ツ)_/¯

solemn leaf
#

message.content.match("^\".+\"$")

quartz kindle
#

what do you want to do with it?

solemn leaf
#

get the text inside of the quotes

#

like

#

the "item name" ammount

quartz kindle
#

then yes, you can use match

solemn leaf
#

it returns null

quartz kindle
#

a regex literal works like this

#

/regex here/

knotty quartz
#

That works on my other bot

solemn leaf
#

does it return an array

quartz kindle
#

so why cant you make a simple message event? @knotty quartz

solemn leaf
#

?

#

still null

knotty quartz
#

Thats how it works opn my other bot

solemn leaf
#

using switches for commands

opal plank
#

i have no clue, but between those screenshots i showed, the second one worked

quartz kindle
opal plank
#

and im super confused cuz that trace is really usefull

#

this works

#

this doesnt

quartz kindle
quartz kindle
knotty quartz
quartz kindle
#

hence why im saying, you dont know js

#

stop pretending you do and look into learning how js works

#

start by learning how scopes work

#

i'll give you an example

lyric mountain
quartz kindle
#

@knotty quartz

client.on("message", message => {
  // message exists here
})

// message does not exist here
// trying to use message here will result in an error
sudden geyser
#

Wise men fear when the code does nothing instead of throwing an error.

knotty quartz
quartz kindle
#

which im 90% sure you didnt write yourself

#

otherwise you wouldnt have issues with something this basic

#

there is no "different format"

solemn leaf
#

Is it || if the thing before was null

knotty quartz
quartz kindle
#

add it on your new bot

#

isnt that what you want to do?

lyric mountain
knotty quartz
#

No bc I need to add something to my proper bot my new one is my TESTING bot for it but the app i use isnt the app I use for my bot bc my friend told me to use repl

quartz kindle
#

what does that have to do with anything?

knotty quartz
#

Soo

quartz kindle
#

js is js, no matter if repl or node or anywhere else

knotty quartz
#

I am explaining

quartz kindle
#

if you use discord.js on both, then its the same on both

lyric mountain
#

oh, wait

#

ig I know what he means

#

rex, do you use Discord Bot Designer or Discord Bot Maker?

knotty quartz
#

?

#

for what

lyric mountain
#

ok, nvm then

#

for the other bot

knotty quartz
#

I use Glitch on my proper bot and pay for its hosting

lyric mountain
#

you pay for glitch...

quartz kindle
#

glitch is expensive af

knotty quartz
#

i may giithub

#

github*

lyric mountain
#

github is no host, it's a repo

knotty quartz
#

Here wait

quartz kindle
#

?

knotty quartz
#

Ik I use a different host for it

quartz kindle
#

tell me, do you understand what this means? ```js
client.on("message", message => {
// message exists here
})

// message does not exist here
// trying to use message here will result in an error

knotty quartz
#

Right Imma scrap this testing bot and use github for it

solemn leaf
#
            const z = message.content.match(/".+"/)[0].toLowerCase()
            console.log(z)
            let x = blocksByName[z] || itemsByName[z];

x.displayName isnt a thing but it is

{
  id: 1,
  displayName: 'Stone',
  name: 'stone',
  hardness: 1.5,
  minStateId: 1,
  maxStateId: 1,
  states: [],
  drops: [ 1 ],
  diggable: true,
  transparent: false,
  filterLight: 15,
  emitLight: 0,
  boundingBox: 'block',
  stackSize: 64,
  material: 'rock',
  harvestTools: { '585': true, '590': true, '595': true, '600': true, '605': true },
  defaultState: 1
}
quartz kindle
#

github or repl is not the problem lol

knotty quartz
lyric mountain
#

github is NOT A HOST

#

you can't run code in it

quartz kindle
#

show your code

knotty quartz
lyric mountain
#

ok, then, you may proceed

knotty quartz
solemn leaf
#

urn your bot in html and host with webhost

lyric mountain
#

you could also, yk, download an actual IDE

lyric mountain
#

since browsers parse html files

knotty quartz
#

Can i copy and paste it

quartz kindle
solemn leaf
#

yeah x is that

knotty quartz
#
 case 'hi':
message.channel.send("Test");
})```
solemn leaf
#

z is "stone"

quartz kindle
#

case doesnt work without switch

#

thats another basic js thing

livid lichen
#
        embed: {
          title: "Text",
          image: Image,
          URL: URLImage,
          color: "#0099ff",
          footer: {
            text: `Test`,
            image: process.env.bot_logo
          }
        }
      });``` Anything I'm doing wrong?
knotty quartz
#

The switch is there

quartz kindle
#

where is it?

knotty quartz
#

Did u need to see that?

quartz kindle
#

of course

#

lmao

knotty quartz
#

Let me repaste it give me a min tim

#

i got 20+ tabs open

solemn leaf
quartz kindle
#

and you console.logged x?

solemn leaf
#

no z

livid lichen
#

Found out. Nvm.

quartz kindle
#

then how do you know what the contents of x is?

solemn leaf
#

ok it is undefined

knotty quartz
#

client.on("message", message => {
switch (variable) {
case 'hi':
message.channel.send("Test");
}
}
)

#

Tim

solemn leaf
#

but I did console.log(blocksByName["a"] || itemsByName["iron_nugget]) and it logged the iron nuggets strats

quartz kindle
knotty quartz
#

command oop

quartz kindle
solemn leaf
knotty quartz
#

I give in ;-;

#

Does anyone know

#

How to cmake it so only the code shows on repl

#

The terminial is annoying

quartz kindle
#

wut? only the code?

fringe pendant
#

@earnest phoenix message.gulid.members

knotty quartz
#

Ye

solemn leaf
#

inspect elm

#

delete

quartz kindle
#

what does that mean lol

#

you mean you want to hide the terminal?

knotty quartz
quartz kindle
fringe pendant
#

gulid

#

try guild lol

#

it's a typo

#

you spelled "guild" wrong

knotty quartz
lyric mountain
quartz kindle
knotty quartz
#

Imma code a different bot in python since I wanna learn pyhon

#

better

lyric mountain
#

dude

merry holly
#

lol

lyric mountain
#

if you're struggling with basic JS syntax you'll die from python syntax

#

it looks easier

#

that's about it

solemn leaf
#

its "iron_nugget" @quartz kindle

knotty quartz
# lyric mountain dude

Bruh I can manage my other bot in js therefore I wanna try something else with ssomeone else

lyric mountain
#

don't hop between languages, it'll just make u confuse

#

become experient in one, only then change lang

knotty quartz
#

Wait let me say

#

If I get this bot with python commands will you stop doubting me?

knotty quartz
slender thistle
#

What would you prove by sending it

knotty quartz
#

That I can script js

earnest phoenix
#

same

quartz kindle
#

its like taking a picture of a car and saying its yours

knotty quartz
#

wait are u saying I am going to send someone else script wow

quartz kindle
#

no, im saying that if you're having very basic issues with JS, then either you received tons of help or someone else made the majority of your code for you

knotty quartz
#

. . . I had help with getting it online wow I did the rest . . .

lyric mountain
#

lines aren't really a metric

quartz kindle
#

if you did what you claim you did, then you should not be having such basic issues

#

thats all

knotty quartz
#

My firend got it online and did the message fixc thing I did every command there so he did like very liyyler

#

little

quartz kindle
#

its like saying "i can speak russian, look i wrote this essay in russian" but then not knowing how to say "hello" in russian

slender thistle
#

I heard Russian

quartz kindle
#

yes blyat cyka

slender thistle
#

poshel nahui

quartz kindle
#

da

earnest phoenix
#

?????

knotty quartz
#

Imma go

quartz kindle
#

also, nobody here is looking for proof, you dont have to prove anything

#

we just want you to learn what you need to learn in order to be able to do what you want to do

earnest phoenix
quartz kindle
slender thistle
#

"we just want you to learn what you need"

knotty quartz
quartz kindle
earnest phoenix
#

Oh

knotty quartz
earnest phoenix
#

oh

solemn leaf
#

tim

quartz kindle
solemn leaf
knotty quartz
#

Now Imma go and code my main bot

quartz kindle
#

its mostly the same thing

earnest phoenix
#

@quartz kindle ok Then how to bring my bot back in bot list

knotty quartz
quartz kindle
#

where is your friend now?

quartz kindle
earnest phoenix
quartz kindle
solemn leaf
#

no

knotty quartz
quartz kindle
#

then wait for him lol

solemn leaf
#

z returns what is in the quotes

#

which was stone

quartz kindle
solemn leaf
#

ye

knotty quartz
#

Then ill be asleep

solemn leaf
quartz kindle
#

but if you do yourthing["stone"] it works?

earnest phoenix
#

I added my bot and then it was showing 60% approved after 2 days that site gone and then I don't know @quartz kindle

solemn leaf
#

yes

quartz kindle
#

you should have gotten a DM from luca

slender thistle
#

Your bot was declined 10-11 days ago

earnest phoenix
knotty quartz
#

Wrong server

quartz kindle
earnest phoenix
#

😭

quartz kindle
#

the reason is written there

quartz kindle
# solemn leaf yes

then you're doing something wrong, test some more, console.log everything

earnest phoenix
solemn leaf
#

I did this

#

"stone"undefined

            const z = message.content.match(/".+"/)[0].toLowerCase()
            const x = blocksByName[z] || itemsByName[z];
            console.log(z + x)
solemn latch
earnest phoenix
slender thistle
#

Fix the listed issues and resubmit your bot

solemn latch
quartz kindle
#

the reason says that you put random stuff and your bot's code in your bot's description

#

plus that you said your bot will be offline

#

is that wrong?

earnest phoenix
crimson vapor
#

Tim what is your favorite thing you have learned from doing all the tests that you do?

quartz kindle
crimson vapor
#

LOL

#

but not about libs

mellow kelp
#

"Blazing fast, efficient and light X"

crimson vapor
#

like just standard js testing

quartz kindle
#

idk its a pain to do this

#

but i like comparing numbers

solemn latch
#

the results are fun to look at

quartz kindle
solemn leaf
# quartz kindle ```js console.log(z, x, blocksByName[z], blocksByName["stone"], itemsByName[z], ...
"stone" undefined undefined {
  id: 1,
  displayName: 'Stone',
  name: 'stone',
  hardness: 1.5,
  minStateId: 1,
  maxStateId: 1,
  states: [],
  drops: [ 1 ],
  diggable: true,
  transparent: false,
  filterLight: 15,
  emitLight: 0,
  boundingBox: 'block',
  stackSize: 64,
  material: 'rock',
  harvestTools: { '585': true, '590': true, '595': true, '600': true, '605': true },
  defaultState: 1
} undefined { id: 1, displayName: 'Stone', name: 'stone', stackSize: 64 }
quartz kindle
#

console.log(typeof z)

solemn leaf
#

string

cinder patio
#

guild.members.cache if you're on v12, which you probably are

quartz kindle
solemn leaf
#

I sent the npm

quartz kindle
#

oh they're not yours?

solemn leaf
#

no

cinder patio
#

that's right, message.guild.members.cache is a Collection

#

.cache.find(...)

quartz kindle
solemn leaf
#

ok

quartz kindle
#

so its basically doing blockByName['"stone"']

solemn leaf
#

gotta

#

how do I remvoe them

cinder patio
#

members.cache.get. guild.members is no longer a collection, to get the collection you need to do guild.members.cache.

sharp plinth
#

well my name is also aki

solemn leaf
#

?

#

its a surname

quartz kindle
#

do this

solemn leaf
#

not a name

quartz kindle
#

.match(/"(.*?)"/)[1]

solemn leaf
#

how do I get the index from the match to slice it?

#
.setAuthor(`Order for ${x.displayName} x${message.content.slice(z.index + z.length)}`)
austere condor
#

Are you using DiscordJS v12?

solemn leaf
# quartz kindle `.match(/"(.*?)"/)[1]`

How do I get the index to cut off everything so I can get how much the person wants of it

.setAuthor(`Order for ${x.displayName} x${message.content.slice(z.index + z.length)}`)
austere condor
#

when you're defining rMember you should use message.guild.member()

i.e. message.guild.member(message.mentions.members.first()

quartz kindle
#

!abc stone 99999 ?

solemn leaf
#

order "Stone" 64

quartz kindle
#

just split on spaces

#

also much better than using regex and quotes

cinder patio
#

roles.cache.has... lmao

solemn leaf
#

no bcs

#

uh

#

lets see

#

Oak Stair

#

That is why I need regex

quartz kindle
#
args = message.content.split(" ");
command = args.shift();
number = args.pop();
block = args.join(" ")
solemn leaf
#

I can just use args.pop()

austere condor
#

@earnest phoenix it should be rMember.roles.add(role)

glossy spoke
#

can someone invite me to the Discord Developers server?

solemn jolt
solemn leaf
#

how did this happen

#
msg.react('👍').then(() => msg.react('👎'));
solemn jolt
lusty quest
lusty quest
solemn jolt
lusty quest
#

react twice to the same message?

lusty quest
solemn jolt
#

Yes

lusty quest
#

did you tryed to reinstall the entire modules folder?

#

also where did you host the bot? iirc the "free" hoster like repl.it doesnt allow music bots and doesnt support them package wise

solemn jolt
#

Iam hosted my bot in heroku

lusty quest
#

yea they dont allow them either

solemn jolt
#

Ok now I well try

lusty quest
#

mostly bcs they eat resources like crazy

crimson vapor
#

e

solemn jolt
lusty quest
#

yes but heroku wont install the module

solemn jolt
#

how I can fix it

lusty quest
#

get a paid VPS

solemn jolt
#

How

lusty quest
#

check the pins in this channel where it said VPS

earnest phoenix
#

Guy are utils for setprefix, invite?

#

@lusty quest

lusty quest
#

?

earnest phoenix
#

Oops sorry..

earnest phoenix
lusty quest
#

yea but what did you mean with this?

#

like a command category?

earnest phoenix
#

Like are they called utilities or utility sorry I’m a bit confused yes command category

glossy spoke
solemn leaf
#

Wait how do I get channel by id again

earnest phoenix
#

They are called utils right?

glossy spoke
lusty quest
solemn leaf
#

you need a subfolder command handler @earnest phoenix

#

thansk

solemn jolt
lusty quest
solemn jolt
#

Did you now another host for github

earnest phoenix
#

No, I was asking that if they are called utils in the help command @solemn leaf

lusty quest
#

but util is fine

earnest phoenix
#

Thanks!

glossy spoke
lusty quest
#

nope they dont allow it bcs of music bots

glossy spoke
#

ow

lusty quest
#

maybe its possible but i guess it will be super annoying to install

earnest phoenix
#

@lusty quest btw you have always been nice to me thanks for that!

glossy spoke
#

so it's not as fast as write npm i ffmpeg?

lusty quest
lusty quest
glossy spoke
#

true

earnest phoenix
solemn leaf
#

How do I send a message to that channel?

quartz kindle
lusty quest
solemn leaf
#
client.channels.cache.get(804070122401955881).send(orderembed)
lusty quest
#

works also

#

@earnest phoenix you got a Invite URL in the snippet remove it

glossy spoke
solemn leaf
#

didnt send it

lusty quest
solemn leaf
#

no error

lusty quest
#

is your embed valid?

glossy spoke
solemn leaf
#

yes

lusty quest
glossy spoke
#

i don't use fetch all time, only in a few cases

lusty quest
#

what is your issue exactly?

rocky hearth
#

Does using Next.js, don't even require to build project with client side react??

earnest phoenix
#

If I want to display my bots picture what do I do?

glossy spoke
lusty quest
#

does your bot got permissions to move your roles?

earnest phoenix
#

I know it’s in discord.js Docs but I can’t figure it out

#

client.user.avatar.URL()

earnest phoenix
glossy spoke
earnest phoenix
#

Oh

glossy spoke
earnest phoenix
#

No, lol

glossy spoke
#

oh

rocky hearth
#

@earnest phoenix Search the docs for MessageEmbed, there a property to set an image

solemn leaf
#

uh

glossy spoke
#

so it's <client>.user.displayAvatarURL();

earnest phoenix
#

Oh my god my brain