#development

1 messages · Page 1745 of 1

slender thistle
#

The vast difference between regex and a manual for-loop

rocky hearth
#

actually Im making a board game where,
each character represents a piece,
a number - total consecutive empty squares
and + and - followed by two characters, represent a square with two pieces.

slender thistle
#

I'm curious why you have a string for that

cinder patio
#

Why are you taking input this way... sounds inconvenient for players and for you

rocky hearth
#

the string is to parse and populate the board. Same as fen is for chess

slender thistle
#

Why not have some kind of object/map for that is what I'm wondering

lyric mountain
#
const string = 'long12+krt89df-efdhjj67nmn';
const args = [];
const everythingElse = [];
let aux = '';
for (const s in string.split(/([+\-])/)) {
    if (s.startsWith("+") || s.startsWith("-"))
        args.push(s);
    else
        aux += s;
}
for (const s in aux.split(/((\d\w)|(\w\d))/)) {
    everythingElse.push(s);
}
old cliff
#

Just use regex and chill

slender thistle
#

Chill with bad performance Sunglosses

old cliff
#

Use matchAll

old cliff
lyric mountain
#

why?

slender thistle
#

"few milliseconds" in a game where that regex runs a lot can be significant

old cliff
#

Is he making a game?

cinder patio
cinder patio
#

let s in ... iterates though the keys

old cliff
#

Its a dc game

lyric mountain
#

oh

#

just a sec

old cliff
#

Not fps mobo

cinder patio
#

Also your version also uses regex and splits, and 2 for loops

#

so it's def slower than a for loop

old cliff
#

Regex is fassss...

cinder patio
#

Regex = 1ms
For loop = 0.07ms

old cliff
#

Recalculate

cinder patio
#

I don't have the code for the regex example, but it's quite obvious the regex one is slower, not only is there regex, but also a reduce and every

old cliff
#

Nevermind... he just wants an answer

slender thistle
#

Regex is fast enough, but not as fast in comparison to manual for-loops

old cliff
#

Fast enough

cinder patio
#

Speed is important when you're making a game

old cliff
#

Also reduce is slow?

cinder patio
#

slower than a regular for loop most of the time

slender thistle
#

"Fast enough" isn't an excuse you should be taking when you're making a game

old cliff
cinder patio
#

We don't know what kind of a game he's making

#

Also, just because something is "fast enough" doesn't mean there's no reason to make it faster

#

plus the regex version is barely readable

slender thistle
#

If you generally apply the "fast enough" option, you're gonna have videogames in JS/Python

#

There are cases when performance doesn't matter as much as it does here, like, say, a cronjob that runs once in an hour or a few

eternal osprey
#

hey

#

does anyone know why my command handler is not closing right?

#

i can use command !help and it will not close the command handler. It will keep on running that exact command, eventhough the event has passed

slender thistle
#

Because it's either bad or you coded it wrong

#

Depending on how you're using it

#

You're gonna have to share your code

eternal osprey
#

yup

#

so i have a function in my bot that starts a collector on the message that has been sent:

#
function Interface(message, question, callback) {

    var collected = false;
    var closed = false;
    var qMessage;
    message.channel.send(question).then((msg) => {
        qMessage = msg;
    });
    const collector = new Discord.MessageCollector(message.channel, m => m.author.id == message.author.id, {maxMatches: 1});
    collector.on("collect", msg => {
        collected = true;
        callback(msg, qMessage);
    });

    collector.on("end", () => {
        closed = true;
        return 0;
    });

    setTimeout(() => {
        if (closed) return;
        else if (!collected) {
            collector.stop("User did not give a response within 20 seconds");
            qMessage.edit(`:x: <@!${message.author.id}>, the menu closed because you did not respond within 20 seconds.`);
            closed = true;
            callback(false);
        }
    }, 20000);

}```
#

and even if i closed the event (i messages something, so the count should be on 1), it still doesn't stop with that exact command

pale vessel
#

@rocky hearth For loop

#

Forgot about the numbers but oh well

#

final.map(x => isNaN(x) ? x : +x); instead of just final

rocky hearth
#

ok I'll take this one

stiff lynx
#

Why I cant filter only with the server ID'

#

?

rocky hearth
#

if u have ignored the .env files in .gitignore, before comitting.
Then there's no way to get it back.

lyric mountain
#

@rocky hearth

#
const start = new Date().getTime();
const string = 'long12+krt89df-efdhjj67nmn';
const args = [];
let aux = '';

let arr = string.split(/([+\-].{2})/);
for (const s of arr) {
    if (s.startsWith("+") || s.startsWith("-"))
        args.push(s);
    else
        aux += s;
}

const everythingElse = aux.match(/((?=\d)\w)+|((?=[A-z])\d)+|[A-z]+/g)
    .filter(s => s)
    .map(s => {
        if (isNaN(s)) return s;
        else return parseInt(s);
    })

console.log(args);
console.log(everythingElse);
console.log(`${new Date().getTime() - start}ms`)
cinder patio
#

use performance.now for more accuracy

lyric mountain
#

k, just a sec

#

also I guess I pinged the wrong dude

cinder patio
#

you didn't

#

0.51ms

lyric mountain
snow night
#

is repl.it good to use for hosting bots?

lyric mountain
#

no

cinder patio
#

yeah you're using regex too

slender thistle
#

Small bots - kind of

#

Large bots - no

snow night
#

?

slender thistle
#

Repl isn't meant for hosting initially, but they support uptime robots and their Hacker plan allows you to leave your repl on 24/7 as well as boosting it with better machine specs

snow night
#

ok

rocky hearth
#

it should return, a single array though, Kuhaku
And the order is important here

snow night
#

how much is repl hacker plan

slender thistle
#

$7/month

snow night
#

k

slender thistle
#

At that point you're better off just renting a VPS, though

snow night
#

i have a credit card but its a prepaid one

#

so it wont work

slender thistle
#

F

snow night
#

yea

stiff lynx
#

Starting from here how the hell I sort the data?
When I do leaderboard.get(guild_ID) it gives me always all the servers
I've tryied with leaderboard.sort((userA, userB) => userA.bank - userB.bank);
But it always console.log all the servers and not sorted by bank.
This is the code => https://srcb.in/IcObTg0kBk

iron venture
#

hi!

pearl trail
stiff lynx
pearl trail
#

from all guilds?

lyric mountain
#

just a sec

stiff lynx
#

I tought to make the collection becoma an array

#

but I dont think it would work

pearl trail
#

so if you just want to get the leaderboard, i don't think you need to create a new collection.... just filter all the collections from database

const database = await <mongo schema>.find()
const guildProfiles = database.filter(x => x.serverID == message.guild.id)
//now you sort here from guildProfiles
iron venture
#

Hii!

stiff lynx
pearl trail
#

wait

pearl trail
#
const database = await <mongo schema>.find()
const guildProfiles = database.filter(x => x.serverID == message.guild.id)
//now you got the array of profiles on your guild
const sorted = guildProfiles.sort((first, second) => first.bank - second.bank, 0)
//sorted.map(x => x.userID) will show you the user id from highest bank value to the lowest
stiff lynx
lyric mountain
#
const start = performance.now();
const string = 'long12+krt89df-efdhjj67nmn';
const args = [];
let aux = '';

let arr = string.split(/([+\-].{2})/);
for (const s of arr) {
    if (s.startsWith("+") || s.startsWith("-")) {
        args.push(s);
        aux += "{%}"
    } else
        aux += s;
}

const everythingElse = aux.match(/((?=\d)\w)+|((?=[A-z])\d)+|[A-z]+|{%}/g)
    .filter(s => s)
    .map(s => {
        if (s === "{%}") return args.shift();
        else if (isNaN(s)) return s;
        else return parseInt(s);
    })

console.log(everythingElse);
console.log(`${performance.now() - start}ms`);
pearl trail
pearl trail
#

np

rocky hearth
#

just 1ms great!
I wonder what Feud's code's performance might be? he didnt mentioned that

cinder patio
#

0.07ms on my machine

dark lagoon
#

so i'm trying to figure out why i can't make my bot read commands from another file and put responses in chat

rocky hearth
#

ooh, thats insane

dark lagoon
#

like, i'm not getting any errors or anything, but it's also not doing anything when i type !help or !commands

cinder patio
#

Keep in mind Kuu's version is 0.51 ms on my machine

lyric mountain
#

obv, you feed rocket fuel to your machine

cinder patio
#

I didn't save my code though ugh

stiff lynx
# pearl trail np

(node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
2021-05-12T13:55:49.148675+00:00 app[Worker.1]: content: Must be 2000 or fewer in length.
OH NO, NOT AGAIN

cinder patio
#

If someone wants to write it from the screenshots feel free

pearl trail
#

what did you put on content?

lyric mountain
#

do note that when I ran that code more than 1 time it started to get increasingly lower times

#

probably due to regex internal optimizations

stiff lynx
pearl trail
#

yes, what did you put on content so it reached > 2000 chars

stiff lynx
#

what Is content?

#

idk what even Is

lyric mountain
#

content = message

stiff lynx
#

RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:39:14)

pearl trail
#

hm form body is embed..

#

maybe idk, or just content like this

pearl trail
#

that didn't came from node_modules

stiff lynx
#

Is the First Time I get this error

pearl trail
#

nope, another one from the stack

stiff lynx
#

how I'm supposed to fix this

pearl trail
#

try send full error with the stacks

stiff lynx
pearl trail
#

for example:
orange line is the error, blue is the error stacks

stiff lynx
#

2021-05-12T13:55:49.148672+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
2021-05-12T13:55:49.148675+00:00 app[Worker.1]: content: Must be 2000 or fewer in length.
2021-05-12T13:55:49.148677+00:00 app[Worker.1]: at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
2021-05-12T13:55:49.148678+00:00 app[Worker.1]: at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-05-12T13:55:49.148679+00:00 app[Worker.1]: at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
2021-05-12T13:55:49.148702+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2021-05-12T13:55:49.148727+00:00 app[Worker.1]: (node:4) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

#

maybe I know

umbral zealot
#

Must be 2000 or fewer in length.

stiff lynx
#

maybe is mecause I tryied to send It to discord

lyric mountain
#

no, shorten ur message

stiff lynx
#

2.000 isnt the message limit?

lyric mountain
#

yep

pearl trail
#

it is the message limit

stiff lynx
#

thats why

zealous egret
#

Can you guys help me what is wrong here

#
async def fight(ctx, user: discord.Member):
    fought = user
    attacker = ctx.author
    if user.id == ctx.author.id:
        await ctx.send("You can't fight yourself weirdo")
    else:
        await ctx.send(user.mention + ", " + ctx.author.mention + " has challenged you to a duel, do you accept? (Y/N)")
        def check(ctx):
            return fought == ctx.author and ctx.content.lower() == 'y'
        try:
            await client.wait_for('reaction_add', timeout=60.0, check=check)
            await ctx.send("Duel invite accepted! Fight will now begin.")
            fightStart = True
        except asyncio.TimeoutError:
            await ctx.send('Duel invite expired.')
            fightStart = False
        else:
            await ctx.send('Duel invite declined.')
            fightStart = False```
lyric mountain
zealous egret
#

wait

cinder patio
#

later calls get even faster for whatever reason

lyric mountain
#

internal

cinder patio
#

JIT babey

quartz kindle
#

JEET

rocky hearth
#

does parse using regexes?

quartz kindle
#

what are you measuring? :^)

stiff lynx
cinder patio
#
function parse(string) {
  const len = string.length;
  const res = [];
  let current_str = "";
  let num_str = "";
  for (let i=0; i < len; i++) {
    const char = string[i];
    switch (char) {
      case "+":
      case "-":
        if (current_str) {
          res.push(current_str);
          current_str = "";
        }
        if (num_str) {
          res.push(+num_str);
          num_str = "";
        }
        res.push(char + string[++i] + string[++i]);
        break;
      default:
        if (isNaN(char)) {
          if (num_str) {
            res.push(+num_str);
            num_str = "";
          }
          current_str += char;
        } else {
          if (current_str) {
            res.push(current_str);
            current_str = "";
          }
          num_str += char;
        }
    }
  }
          if (current_str) {
          res.push(current_str);
          current_str = "";
        }
        if (num_str) {
          res.push(+num_str);
          num_str = "";
        }
  return res;
}

Before I close the tab...

lyric mountain
cinder patio
#

btw the code above can definitely be improved

pale vessel
#

@cinder patio can you test this on your machine? ```js
const originalString = "long12+krt89df-efdhjj67nmn";
let final = [];

for (let i = 0; i < originalString.length; i++) {
if (
i === 0
|| ["-", "+"].some(x => originalString[i] === x)
|| isNaN(final[final.length - 1]) && !isNaN(originalString[i])
|| !isNaN(final[final.length - 1]) && isNaN(originalString[i])
) {
final.push(originalString[i]); continue;
}

if (
    ["-", "+"].some(x => final[final.length - 1].startsWith(x)) && final[final.length - 1].length < 3
    || ["-", "+"].every(x => !final[final.length - 1].startsWith(x)) && isNaN(originalString[i]) && isNaN(final[final.length - 1])
    || !isNaN(originalString[i]) && !isNaN(final[final.length - 1])
) {
    final[final.length - 1] += originalString[i]; continue;
}

final.push(originalString[i]);

}
final.map(x => isNaN(x) ? x : +x);```

zealous egret
#
@client.command()
async def fight(ctx, user: discord.Member):
    fought = user
    attacker = ctx.author
    if user.id == ctx.author.id:
        await ctx.send("You can't fight yourself weirdo")
    else:
        await ctx.send(user.mention + ", " + ctx.author.mention + " has challenged you to a duel, do you accept? (Y/N)")
        def check(ctx):
            return fought == ctx.author and ctx.content.lower() == 'y'
        try:
            await client.wait_for('reaction_add', timeout=60.0, check=check)
            await ctx.send("Duel invite accepted! Fight will now begin.")
            fightStart = True
        except asyncio.TimeoutError:
            await ctx.send('Duel invite expired.')
            fightStart = False
        else:
            await ctx.send('Duel invite declined.')
            fightStart = False
#

Error

lyric mountain
zealous egret
lyric mountain
#

oh, right

lyric mountain
#

mb then

zealous egret
#

?

lyric mountain
#

@cinder patio this too:```js
function parse(text) {
const args = [];
let aux = '';

let arr = text.split(/([+\-].{2})/);
for (const s of arr) {
    if (s.startsWith("+") || s.startsWith("-")) {
        args.push(s);
        aux += "{%}"
    } else
        aux += s;
}

const everythingElse = aux.match(/((?=\d)\w)+|((?=[A-z])\d)+|[A-z]+|{%}/g)
    .filter(s => s)
    .map(s => {
        if (s === "{%}") return args.shift();
        else if (isNaN(s)) return s;
        else return parseInt(s);
    })
return everythingElse;

}

pearl trail
lyric mountain
quartz kindle
#

what is the code supposed to do?

pale vessel
#

magic

stiff lynx
#

with a for?

#

that works 10 times?

lyric mountain
#

10 times?

crimson vapor
#

if I throw an error inside of a .then will it still be caught by the .catch?

pale vessel
#

What the hell is your specs

lyric mountain
stiff lynx
lyric mountain
#

the first call is always slower

pearl trail
#

like shows only 10 users?

#

ah

cinder patio
#

Then it's around 0.05

rocky hearth
#

@quartz kindle this all started from here

cinder patio
#

always ^

pearl trail
#

sorted.length = 10

pale vessel
#

That's not bad

#

igh

quartz kindle
#

hmmm

#

lets see

pale vessel
#

Slice is faster than setting length

stiff lynx
lyric mountain
#

mine gave 0.49 then oscilated between 0.06 and 0.04

pearl trail
pale vessel
#

Well, anything with for loop is fast

lyric mountain
#

heckin rocket fuel

stiff lynx
pearl trail
#

yes

cinder patio
#

Mine's only with a for loop so that's probably why it's the fastest

zealous egret
#
async def fight(ctx, user: discord.Member):
    fought = user
    attacker = ctx.author
    if user.id == ctx.author.id:
        await ctx.send("You can't fight yourself weirdo")
    else:
        await ctx.send(user.mention + ", " + ctx.author.mention + " has challenged you to a duel, do you accept? (Y/N)")
        def check(ctx):
            return fought == ctx.author and ctx.content.lower() == 'y'
        try:
            await client.wait_for('reaction_add', timeout=60.0, check=check)
            await ctx.send("Duel invite accepted! Fight will now begin.")
            fightStart = True
        except asyncio.TimeoutError:
            await ctx.send('Duel invite expired.')
            fightStart = False
        else:
            await ctx.send('Duel invite declined.')
            fightStart = False```
pale vessel
#

How fast is yours again

#

0.01ms?

lyric mountain
zealous egret
cinder patio
#

Around 0.10

cinder patio
pale vessel
#

I bet Tim is writing his code right now

cinder patio
#

At first I got 0.1ms now I'm getting 0.10ms

lyric mountain
#

what are your specs btw?

pale vessel
#

^^

lyric mountain
#

that's about 5 times faster than my pc

zealous egret
lyric mountain
#

catch this

#

not asyncio.TimeoutError

cinder patio
#

my PC is not that powerful

#

Intel core i5-8400 6 cores

#

8 gigs of ram

lyric mountain
stiff lynx
lyric mountain
#

I bet tim will appear with a bitwise solution

#

or some weirdo stuff like that

stiff lynx
zealous egret
lyric mountain
zealous egret
#

and with what I have to repalce?

rocky hearth
#

he must be writing his machine code

lyric mountain
pearl trail
#

reverse

zealous egret
lyric mountain
#

read the error there

zealous egret
#

yeah I see but fon t kbnow what is wrong

lyric mountain
#

fruit.water.Watermelon is not the same as fruit.Watermelon

#

you need to use the full path

zealous egret
#

so can yoiu write what?

lyric mountain
#

no

cinder patio
zealous egret
#

??????

lyric mountain
#

as I see, you're touching a quite complex stuff, if you don't know what you should replace and with what you might consider delaying that command until you're ready to handle that stuff

#

interactive games (like duel) are not something simple

zealous egret
#

ok

lyric mountain
#

this is your error

#

this is the except clause

#

you need to fix the except definition

stiff lynx
lyric mountain
#

why are you building the embed after sending the messages?

pearl trail
#

it will throw a new error because there's nothing inside field

stiff lynx
pearl trail
#

oh, nope it won't work

slender thistle
#

Wait

#

Why are you using reaction_add

#

and not message

pearl trail
#

you don't need for again

#
.addDescription(sorted.map((user, counter) => `${counter ++ +1} | ${client.users.cache.get(user.userID)}'s bank is ${user.bank} `).join('\n'))

use map

lyric mountain
#

++ +1?

stiff lynx
pearl trail
#

yes?

#

it works well

#

or just remove ++

#

it will be counter + 1

#

if you're not sure

stiff lynx
eternal osprey
#

hey does anyone know what the topology destroyed error in mongodb means?

#

And even more important, how to fix it.

#

it keeps on showing up when using a certain pay command

stiff lynx
pearl trail
#

¯\_(ツ)_/¯

pearl trail
#

sorry

#

setDescription

#

my bad

stiff lynx
lyric mountain
#

hm

#

so basically you increment i for the next access then add 1

stiff lynx
#

idk why thr last One is undefined

#

invalid user because Left the server?

pearl trail
#

not cached most probably

stiff lynx
lyric mountain
#

so (i++ +1) + ' is lower than' (i + 1) will return 1 is lower than 2

stiff lynx
#

I should catch the err?

pearl trail
#

nope, wait

lyric mountain
pearl trail
#
sorted.map((user, counter) => `${counter +1} | ${client.users.cache.get(user.userID) ? client.users.cache.get(user.userID) : 'Unknown'}'s bank is ${user.bank} `).join('\n')
lyric mountain
#

definitely smells trouble if you need to use i more than once in the same loop

pearl trail
#

so i started from 1?

lyric mountain
#

no

#

it started from 0

#

increment add 1 to it but still returned 0, then you added +1

#

so it returns 1

stiff lynx
pearl trail
#

oh

lyric mountain
#

then, on the second access it returns 1, which I add +1

#

so 2

pearl trail
lyric mountain
#

basically i++ returns the current value and increment

#

so subsequent accesses will get the new value

pearl trail
#

oooo, didn't know it increment the value, thx for the information

lyric mountain
#

i++ is the same as i += 1 which is the same as i = i + 1

#

then there's ++i

#

which increments and return the new value

stiff lynx
rocky hearth
#

Thanks to u all 3

stiff lynx
lyric mountain
#

i++ = return THEN increment
++i = increment THEN return

crimson vapor
#

im like 90% sure ive been assigning i++ to stuff

cinder patio
#

you can, it'll just be the number before the increment

#

so 3++ will return 3

#

++3 will return 4

lyric mountain
#

it's just that subsequent calls will get the incremented value, so beware with indexes and stuff

stiff lynx
pearl trail
#

nice

stiff lynx
stiff lynx
pearl trail
#

sorry i can't help you anymore, i need to sleep. cya

stiff lynx
earnest phoenix
#

In React I am importing some modules from a file and using them in my code:

import {
  Operator
} from "./components.js";

export default function App() {
  const [expr, setExpr] = React.useState("0");
  
  return (<>
    // use the components here
</>)
}

But when I try to use the state variable expr inside any of the components imported it says it is undefined. How do I pass local variables to components?

cinder patio
#

How do you use them

#

you left out the most important part

#

Also show how you use expr inside the component

earnest phoenix
cinder patio
#

expr is in the first parameter of the function

#

{ children, expr }

#

also very weird formatting there

earnest phoenix
cinder patio
#

they're not?

vivid fulcrum
#

are you maybe thinking of react context

earnest phoenix
#

what the heck is that

cinder patio
#

generally you shouldn't need it unless you want to pass a variable many many levels down the hierarchy

#

just pass expr as a prop to Operator

earnest phoenix
#

slight problem i use the component too many times:

<Bracket>(</Bracket><Bracket>)</Bracket>      <CE />      <AC />
                    
<Num>7</Num>    <Num>8</Num>    <Num>9</Num>    <Operator>/</Operator>

<Num>4</Num>    <Num>5</Num>    <Num>6</Num>    <Operator>*</Operator>
                    
<Num>1</Num>    <Num>2</Num>    <Num>3</Num>    <Operator>+</Operator>
                    
<Num>0</Num>    <Decimal  />    <Equals   />    <Operator>-</Operator>
cinder patio
#

Are you making a calculator

earnest phoenix
#

yeah

#

but refactoring the code

cinder patio
#

You're doing it 4 times

#

<Operator expr>/</Operator>

earnest phoenix
#

what about the numbers

cinder patio
#

same thing, you cannot really avoid passing expr without contexts, which imo are supper unnecessary in most cases, including here

earnest phoenix
#

i dont even know what that is so

#

hardcode time

cinder patio
#

Also I think it should be expr={expr}

#

I don't thin that's a shorthand

#

You can also do something like:

const NumWithExp = (props) => {
   <Num expr={expr}>{props.children}</Num>
}

<NumWithExp>0</NumWithExp>
```\
#

if you're feeling really lazy

earnest phoenix
#

i did try that before

#

but i dont want a thicc app component code

uneven fulcrum
#

Im tryna send a message to the user when they vote
how would i do that const voteuser = vote.user voteuser.send('Thx for voting!')
This doesnt work

vivid fulcrum
#

because the object you get from topgg isn't a djs object lol

earnest phoenix
#

lmao

uneven fulcrum
#

oh

#

so how do i get it

#

like the id of the user who votes

earnest phoenix
uneven fulcrum
#

ok ty

earnest phoenix
#

then get the user from your client cache an dm them

uneven fulcrum
exotic bane
#

is there something wrong this is not loading in the page ?```html
<p style="color:cyan;">This is a multipurpose bot and the main thing is that all commands are free*🆓 This bot is easy to use bot, this bot will do giveaways 🎉, moderation 🔱, and games 🎲. Work of mee6, Caral & give away bot all in 1 and all commands are free 🔥🔥🔥</p>

<p style="color:lightblue;">The prefix is (=) and the help command is (=help)</p>

<a href="https://top.gg/bot/785328945691885608/vote">click here to vote for me !</a>

<p style="color:deeppink;">🔱 Moderation🔱 - Can warn, kick, ban, unban, create roles, give roles, and much more with easy-to-use commands.</p>

<p style="color:deeppink;">🎉 Giveaways 🎉** - can easily create give-aways even if you don't know-how, with the help of the easy-to-use commands.</p>

<p style="color:deeppink;">🎲 Games 🎲** - can play many games like rock, paper, scissors, rolling a dice, willit, truth or dare much more</p>

<p style="color:deeppink;">🆘 Deletion 🆘** - can delete links and inappropriate words. (can be disabled.)</p>

<p style="color:deeppink;">✍️ Styles ✍️** - if you want to do an announcement, you can easily complete it.EG- you can create an embed, can bold, underline, cut your sentences.</p>

<p style="color:deeppink;">➕ Math ➗** - can solve math problems (add, square, divide) you can also use decimals and raised power. (EG- =add 123.56 2.12 or =add 10e3 20e6.)</p>

<p style="color:deeppink;">😂 Memes 😂** - do you need some memes? this bot can also do this for you!</p>

<p style="color:deeppink;">📋 Poll 📋** - can also create polls.</p>

<p style="color:yellow;">Contact staff ☎️- you can suggest commands to the staff so they can add it for you (should be under the bot rules)</p>``` pls help !

cinder patio
#

jeez

uneven fulcrum
cinder patio
earnest phoenix
#

25k bobux for a vote is way too much bro

uneven fulcrum
#

lol

#

just for now

earnest phoenix
#

Why does some actions like .roles.set requires 2fa?

#

do I as dev need 2fa or the user ?

earnest phoenix
vivid fulcrum
#

yeah imagine caring about your privacy pffft

crimson vapor
#

2fa is only annoying if you don't have a phone to login with

vivid fulcrum
#

i mean

#

link with a phone once and get a desktop app

#

authy allows that

#

i used the desktop app while my phone was at a repair shop

rocky hearth
#

how good it would be for a dart code compiled to js?

#

would it be any beneficial.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

rocky hearth
#

dart does have mixins. I want use that

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

rocky hearth
#

to run it in browser

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

cinder patio
#

dart gets compiled to js in order to work in the browser

#

flutter is for mobile apps

sage bobcat
#

One message removed from a suspended account.

rocky hearth
#

flutter does convert dart code to js, I think

sage bobcat
#

One message removed from a suspended account.

cinder patio
#

I don't think it does, dart can also be compiled

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

cinder patio
#

So it's unlikely that it gets converted to js in flutter

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

rocky hearth
#

it does get, I hope so. If we use flutter to make web apps. Isnt it?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

rocky hearth
#

yeah, they say flutter is the future.

sage bobcat
#

One message removed from a suspended account.

rocky hearth
#

But I dont believe google. They do drop there products quickly

sage bobcat
#

One message removed from a suspended account.

cinder patio
#

meh I'd rather use typescript over dart

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.

uneven fulcrum
#

How would i make this async ```js
const usersend = vote.user.id
const newuser = await Client.users.fetch(usersend)
newuser.send('Thanks for voting! You recieved 10k bobux')

})

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

uneven fulcrum
#

cuz im using await

#

and i need async for it

sage bobcat
cinder patio
#

like mixins

sage bobcat
#

One message removed from a suspended account.

rocky hearth
#

yes. I like dart alot.

sage bobcat
#

One message removed from a suspended account.

uneven fulcrum
cinder patio
#

dart also has type-safety

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

cinder patio
#

I was talking about dart

uneven fulcrum
#

dbl.webhook.on('vote', (vote) => {
  console.log(`${vote.user} has voted me`)
  const webhook = new Discord.WebhookClient('', '')
  webhook.send(`${vote.user} has voted me`)
  const usersend = vote.user.id
  const newuser = await Client.users.fetch(usersend)
  newuser.send('Thanks for voting! You recieved 10k bobux')
  
})
uneven fulcrum
#

like where

sage bobcat
#

One message removed from a suspended account.

uneven fulcrum
#

oh

#

ty

sage bobcat
#

One message removed from a suspended account.

uneven fulcrum
sage bobcat
#

One message removed from a suspended account.

uneven fulcrum
sage bobcat
#

One message removed from a suspended account.

uneven fulcrum
pale vessel
#

npm ls discord.js

uneven fulcrum
#

ok

uneven fulcrum
sage bobcat
#

One message removed from a suspended account.

uneven fulcrum
#

ok

#

u mean client.users.cache.get?

#

@sage bobcat

sage bobcat
#

One message removed from a suspended account.

pale vessel
uneven fulcrum
pale vessel
#

what did you do?

sage bobcat
#

One message removed from a suspended account.

near stratus
uneven fulcrum
#

ok

pale vessel
#

don't need to do that

#

fetch() is enough

pale vessel
uneven fulcrum
pale vessel
#

isn't it vote.user?

earnest phoenix
#

does somebody now a lib which can compile html to react?

uneven fulcrum
#

@pale vessel

pale vessel
#

it's just user

#

which is the ID itself

uneven fulcrum
#

ohh ok ty

lyric mountain
#

but you can use html in react

uneven fulcrum
#

no errs tho

pale vessel
#

did it log <id> has voted me

uneven fulcrum
#

nvm an error

uneven fulcrum
#

how do i clear logs on bitvise ssh client

#

anyone know]

uneven fulcrum
# pale vessel did it log `<id> has voted me`

i got this error js 0|index | TypeError: Cannot read property 'fetch' of undefined 0|index | at DBLWebhook.<anonymous> (/root/bot/structures/Client.js:39:38) 0|index | at DBLWebhook.emit (events.js:314:20) 0|index | at IncomingMessage.<anonymous> (/root/bot/node_modules/dblapi.js/src/webhook.js:83:16) 0|index | at IncomingMessage.emit (events.js:314:20) 0|index | at endReadableNT (_stream_readable.js:1241:12) 0|index | at processTicksAndRejections (internal/process/task_queues.js:84:21)

pale vessel
#

what's Client?

#

it needs to be your Discord client

#

not the class

#

some people call it client or bot

uneven fulcrum
earnest phoenix
#

and client.users.fetch() not client.users.cache.fetch()

uneven fulcrum
near stratus
uneven fulcrum
pale vessel
#

console.log(Client)

pale vessel
uneven fulcrum
#

i used a constructor

pale vessel
#

you need the instance

uneven fulcrum
uneven fulcrum
pale vessel
#

did you just remove Client.

uneven fulcrum
#

i forgot

pale vessel
uneven fulcrum
near stratus
pale vessel
#

how did you initialize your client

uneven fulcrum
#

still get this

uneven fulcrum
pale vessel
#

you must have used new EconomyClient() somewhere

near stratus
#

Wait client.users is undefined ?
how ?

uneven fulcrum
#

oops all caps

#

so ```js
const { Client, Collection } = require("discord.js");

#

and then ```js
class EconomyClient extends Client {

#

@pale vessel

pale vessel
#

not there

uneven fulcrum
#

module.exports = EconomyClient;

#

?

pale vessel
#

ah

uneven fulcrum
#

so client is economy client

#

basically

pale vessel
#

did you use new Client() anywhere?

uneven fulcrum
#

nope

pale vessel
#

what about require("Client.js")?

#

or anything similar

uneven fulcrum
pale vessel
#

on all of them?

uneven fulcrum
#
const { Message } = require('discord.js')
const Client = require(`../structures/Client`)
const Discord = require('discord.js')
const stats = require('./stats')
module.exports = {
    name: `vote`,
    /**
     * @param {Client} client
     * @param {Message} message
     * @param {String[]} args
     */
run: async(client, message, args) => {
}
}

#

that is an example command

pale vessel
#

where did you put the dbl webhook event?

uneven fulcrum
pale vessel
#

can you send the file?

uneven fulcrum
#

ok

uneven fulcrum
pale vessel
#

use this.users.fetch()

#

this would refer to the client itself

#

that would be the instance

uneven fulcrum
#

ohh yeah

#

i completely forgot i did that

#

sorry for wasting ur time

#

yess it worked @pale vessel ty

quartz kindle
#

@lyric mountain@cinder patio welp i tried my hand at it

#

for that particular string, i got the same performance as google's

#

but for larger strings, mine is much faster

pale vessel
#

that took quite a while

lyric mountain
#

show us dababy

quartz kindle
#

also

pale vessel
#

dababy

quartz kindle
#

google's parses numbers as actual numbers

#

mine just treats them as strings

cinder patio
#

gimme the code

lyric mountain
#

tim's becoming cd projekt

#

hyping too much

quartz kindle
#

parse is google's, test is mine

lyric mountain
#

you gotta parse it btw

#

like, numbers must become numbers

quartz kindle
#

do they?

lyric mountain
#

yep

quartz kindle
#

then you get invalid numbers

#

i mean

#

you lose precision

#

but fine

lyric mountain
#

the 3 conditions were:
A - every 2 chars preceeded by + or - must be captured
B - words must be separated from numbers
C - numbers must be numbers

quartz kindle
#

alright

lyric mountain
#

oh and
4 - order must be maintained

quartz kindle
#

made mine a bit slower than googles for small strings

#

but still faster for larger strings

#
function test(str) {
    let result = [];
    let len = str.length;
    let xnum = /[0-9]/g;
    let xstr = /[a-zA-Z]/g;
    let nextnum = xnum.exec(str)?.index ?? Infinity;
    let nextstr = xstr.exec(str)?.index ?? Infinity;
    let nextplus = str.indexOf("+") ?? Infinity;
    let nextminus = str.indexOf("-") ?? Infinity;
    if(nextplus === -1) { nextplus = Infinity; }
    if(nextminus === -1) { nextminus = Infinity; }
    let curr = Math.min(nextnum, nextstr, nextplus, nextminus);
    let next = 0;
    let x = 0;
    while(curr < len) {
        switch(curr) {
            case nextnum: {
                next = Math.min(nextstr, nextplus, nextminus);
                xnum.lastIndex = next;
                nextnum = xnum.exec(str)?.index ?? Infinity;
                result.push(Number(str.slice(curr, next)));
                break;
            }
            case nextstr: {
                next = Math.min(nextnum, nextplus, nextminus);
                xstr.lastIndex = next;
                nextstr = xstr.exec(str)?.index ?? Infinity;
                result.push(str.slice(curr, next));
                break;
            }
            case nextplus: case nextminus: {
                next = curr + 3;
                xnum.lastIndex = next;
                nextnum = xnum.exec(str)?.index ?? Infinity;
                xstr.lastIndex = next;
                nextstr = xstr.exec(str)?.index ?? Infinity;
                if(curr === nextplus) { let i = str.indexOf("+", next); nextplus = i > -1 ? i : Infinity; }
                if(curr === nextminus) { let i = str.indexOf("-", next); nextminus = i > -1 ? i : Infinity; }
                result.push(str.slice(curr, next));
                break;
            }
        }
        curr = next;
    }
    return result;
}
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

lyric mountain
#

let let let let let let let let

quartz kindle
#

yes

#

lets go

cinder patio
#

gg

lyric mountain
#

hm, didn't test in a loop

#

brb

quartz kindle
#

looping over characters is fast for small strings

#

but gets super slow once strings get larger

#

so i tried going the indexOf route

#

but managing 4 different indexes aint easy

lyric mountain
#

please send the two strings u used here

quartz kindle
#

"long12+krt89df-efdwefwoefhowuehguwhgo2380470283740823704283490820wefwefwehjj67nmn"

#

"long12+krt89df-efdhjj67nmn"

lyric mountain
#

yours is indeed fast

quartz kindle
#

google still wins the challenge for the provided string

#

gj

lyric mountain
#

well, it's google

quartz kindle
#

ok google

#

call justin bieber

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

crimson vapor
#

WHY ARE WE PARSING SHIT STILL

cinder patio
#

why not

earnest phoenix
# quartz kindle call justin bieber

Google Calling Justin Bieber...

Bieber lifts the call and he says... You know you can call me if you need someone... I need you to hold on, Heaven is a place not too far away

quartz kindle
#

@lyric mountain@cinder patio i was being really dumb and over complicated everything lmao

#

code is now 3x smaller and a tiny bit faster

#
function test2(str) {
    const result = [];
    const reg1 = /[^0-9]/g;
    const reg2 = /[^a-zA-Z]/g;
    for(let i = 0; i < str.length;) {
        const char = str[i];
        if(!isNaN(char)) {
            reg1.lastIndex = i;
            let next = reg1.exec(str)?.index;
            if(!next) { next = str.length; }
            result.push(Number(str.slice(i, next)));
            i = next;
        } else if(char !== "+" && char !== "-") {
            reg2.lastIndex = i;
            let next = reg2.exec(str)?.index;
            if(!next) { next = str.length; }
            result.push(str.slice(i, next));
            i = next;
        } else {
            result.push(str.slice(i, i += 3));
        }
    }
    return result;
}
cinder patio
#

impressive

quartz kindle
#

its basically looping over characters but advancing the index using regex with position indexes

spare badger
#

@quartz kindle Interesting to see you use performance.now() . Didn't know about that function. I always use console.time / console.timeEnd

quartz kindle
#

there's also process.hrtime() if you're on node

#

they all have roughly the same precision since they were all nerfed to fix the spectre problem

fresh verge
#

How would I end a message collector if there is no time limit, or no collection limit?

sage bobcat
#

One message removed from a suspended account.

sage bobcat
#

One message removed from a suspended account.

fresh verge
rocky hearth
#

Ooh, someone should have mentioned me too, to see the tim's code

rocky hearth
fresh verge
#

Ty.

quartz kindle
rocky hearth
#

What type should I give to the class property that stores reference of methods of its own class

class A {
  prop: Type
  constructor() {
    this.prop = this.doSomething
  }
  doSomething(num: number): string {}
  doSomethingElse(num: number): string {}
}

So what Type should be? Later in program, I'll assign prop to doSomethingElse.

quartz kindle
#

Function?

rocky hearth
#

All the methods, that I'll assign, will be of same signature

fresh verge
#

How do I make it so it checks if like args equal Test, but how do I make it not case sensitive?

solemn latch
#

make the arg lowercase

#

if (arg.toLowerCase() === "test")

cinder patio
#

Same signature as the doSomething function

rocky hearth
#

it's just that simple? I was confuse, if prop will have same this.

cinder patio
#

it won't, you'll have to use bind

#

this.doSomething.bind(this)

rocky hearth
#

what if I make doSomething an anonymous function?

cinder patio
#

Then it won't have a this

#

unless you bind it

rocky hearth
#
class A {
  prop: Type
  constructor() {
    this.prop = this.doSomething
    this.prop()
  }
  doSomething = (num: number) => {
    return this.doSomethingElse(num)
  }
  doSomethingElse(num: number): string {}
}

So this wont work?

cinder patio
#

Actually it will

#

wait

#

no that won't work

crimson vapor
#

uhh

cinder patio
#

Anon functions will work tho

crimson vapor
#

prop would need to be the same as doSomething

cinder patio
#

mb

crimson vapor
#

I don't see why you would reassign something just to run it

rocky hearth
#

I want to reassign prop dynamically to other methods

cinder patio
#

Here's the thing tho: why?

#

You can't do that in a clean manner in TS

crimson vapor
#

you would need to do js class Class { property?: Type | OtherType | AnotherType constructor () { this.prop = something this.prop() } }

#

even then its stupid

rocky hearth
crimson vapor
#

you could but it would be fucky wucky

#

you would need to do what I did

cinder patio
rocky hearth
#

prop can be of a single type, as I said, the signatures of all the methods would be same.

cinder patio
#

Then you can do

this.prop = this.doSomething.bind(this)
crimson vapor
#

thats a redundant bind I thought

rocky hearth
#
class A {
  constructor() {
    this.prop = this.doSomething
    this.prop()
  }
  doSomething = (num) => {
    return this.doSomethingElse(num)
  }
  doSomethingElse(num) {console.log('haha')}
}

I tried this, and it worked.
I'll change doSomethingElse to anonymous funciton as well.

#

Actually I'm trying to implement Strategy Design Pattern here

fresh verge
#

How do I check whether a message collector was ended by collector.stop, or timing out?

rocky hearth
fresh verge
rocky hearth
#
collector.on(`end`, (collected, reason) => {
})
fresh verge
#

Ty.

rocky hearth
#

reason gives the reason collector ended. "time" | "idle" there might be one more. idr

median moss
#

hello, I need help with HTML: how can I make a file become from a specific page of a website?

#

for example

#

I have a file called index.html, which is the main page of the website

#

and I want to make a file for a /commands part of the website

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

stable eagle
median moss
stable eagle
#

on the index

#

.hmtl

median moss
#

ok

#

thx

median moss
#

like that?

stable eagle
#

Almost

#

You need to use the file path

median moss
#

wdym?

stable eagle
#

Like ./commands.html

median moss
#

so instead of "commands" I should put "commands.html"?

#

🤔

stable eagle
#

with ./ at start, yes.

median moss
#

ok

median moss
#

cause I put in the button and it started installing an archive lmao

stable eagle
#

@median moss Well, if it’s a button you want to link a page to,

median moss
#

yea

#

but I want to know first how to make this page

#

.-.

#

like what you were explaining

stable eagle
median moss
#

the file stuff

#

.-.

fresh verge
#

So, say I want the bot to say a list, but without the comma and a space of each thing in the list, how would I do that?

quartz kindle
#

language?

fresh verge
quartz kindle
#

you can use array.map()

cinder patio
#

.join

quartz kindle
#

or join() yes

leaden inlet
#

can anybody help me host an open source bot on heroku

outer void
#

what's the problem you having?

leaden inlet
#

im trying to host RoVer on heroku

#

its open source but i cant figure out where im going wrong

dusk hatch
#

rover is your bots name?

leaden inlet
#

its an open source bot

dusk hatch
#

oh

leaden inlet
#

that is free to hosy

#

i have only ever hosted my own bots

#

could anybody help

dusk hatch
#

ok so do you know the basic step what to do?

#

and which language?

leaden inlet
#

should i dm u

#

this bot is confusing

dusk hatch
#

um but which Language?

leaden inlet
#

let me check

dusk hatch
#

bruh

#

discord.js/discord.py or smth else?

leaden inlet
#

js

dusk hatch
#

u mentioned standard.js?

leaden inlet
#

i just pressed docs and it loaded

dusk hatch
#

um never heard about it

leaden inlet
dusk hatch
#

o

leaden inlet
#

i can send the github link

dusk hatch
#

ig i cant help sorry

leaden inlet
#

alr

dusk hatch
#

can help you with node.js

leaden inlet
#

wait

#

i think its discord.js

#
GitHub

RoVer is a Discord bot that enables you to quickly and easily add Roblox-Discord account verification with a system that already has thousands of account links in its database. - evaera/RoVer

#

this is the github

outer void
#

did you created the procfile on this bot?

lyric mountain
#

he probably didn't even create the bot

leaden inlet
#

its open source

#

i said that

lyric mountain
#

still, why don't u invite the bot itself?

outer void
#

yes, i know but you also said that you want to host it on heroku and that you already have bots hosted there

worn sonnet
#

Hey! Can anyone recommend me Instagram libs for python other than instapy or instabot

leaden inlet
#

yes but

#

im used to index.js

#

idk where to impliment the procfile

lyric mountain
#

like, why go through all the hassle to host it if you can use the original?

leaden inlet
#

my preference

lyric mountain
#

yk it'll not be 24/7 right?

#

and if errors occur you'll be helpless

leaden inlet
#

i added a card to heroku

#

so i get 1k hours a month

lyric mountain
#

hm, ok then, that solves the first issue

outer void
#

ok

leaden inlet
#

idk if anybody can help then uh

#

pls

cinder patio
#

no one in the world can help you man

#

sorry

lyric mountain
leaden inlet
#

to hosting locally

proven lantern
#

only ben can help you

lyric mountain
leaden inlet
#

yh but

#

ive hosted before but

#

ive never hosted an already coded bot

#

it has all the files

lyric mountain
#

well, it's up to you to figure out how to work with it

#

also

ive hosted before but
ive never hosted an already coded bot
choose one

leaden inlet
#

ive never hosted an already coded bot

lyric mountain
#

so you never hosted a bot

leaden inlet
#

ive coded and hosted my own on heroku

lyric mountain
#

ah, you already coded one before

outer void
#

try the basics like creating the .procfile on the root of your project and setup the project on heroku like you already have done before

leaden inlet
lyric mountain
#

the steps are the same regardless if it's your own or another bot

proven lantern
leaden inlet
#

wait

lyric mountain
#

just repeat what you've done for your bot

leaden inlet
#

let me try hosting locally 1 sec

lyric mountain
#

and fill the client.json as the readme.md says

leaden inlet
#

same thing i got last time

outer void
#

before using it you installed the node modules?

leaden inlet
#

npm install

#

?

outer void
#

yes

cinder patio
#

You don't need a procfile for a node.js app anymore

leaden inlet
#

i did let me try again

cinder patio
#

just a main entry

leaden inlet
#

it errored

#

@outer void

vivid fulcrum
#

install git

earnest phoenix
#

Hi

leaden inlet
#

github desktop?

vivid fulcrum
#

no, git

lyric mountain
#

git

leaden inlet
#

downloadin

#

?

lyric mountain
#

just press next

#

to all steps

solemn latch
#

pretty sure all the defaults are fine with git

outer void
#

use the default options that it offers

leaden inlet
#

alright installing

#

finished

#

ive redownladed the repo

#

can u instruct me

worn sonnet
#

Yeah the deafults are fine with git

#

Just make sure u check on add to path

leaden inlet
#

??

#

never used this

worn sonnet
#

Oh there's a check box which will say as add to path

leaden inlet
#

i did default for all

worn sonnet
#

What it does is add the system variable for ya

worn sonnet
leaden inlet
outer void
#

now open a new cmd

leaden inlet
#

in the folder?

outer void
#

and type npm -v

outer void
leaden inlet
outer void
#

sorry

#

lol

leaden inlet
#

?

outer void
#

not npm

leaden inlet
#

what do i put

outer void
#

git --version

#

type this on the cmd

leaden inlet
outer void
#

if it is showing that then git is added to your enviromnent variables which is good

leaden inlet
#

next step?

outer void
#

now go to your project and type npm install again

leaden inlet
#

its starting

#

in the mean time

#

will we need any of this

outer void
#

idk about the step 6 but the others yes

leaden inlet
#

it was downloading at the start

earnest phoenix
#

any1 know how to make it so ppl can change the prefix of the bot

#

because i am just stooopidd

vivid fulcrum
#

you need a database

outer void
leaden inlet
#

yh downoadjng

vivid fulcrum
#

or just windows build tools

leaden inlet
#

latest version?

vivid fulcrum
#

do npm i -g windows-build-tools

#

because you're going to need it anyways

outer void
leaden inlet
#

do i do python latest version?

outer void
leaden inlet
#

should i re download tho

#

repo*

vivid fulcrum
#

all of that would be stored in whatever table, i.e. GUILDS

outer void
leaden inlet
#

close?

outer void
#

ok

#

yes

outer void
#

now open a new cmd and type py

leaden inlet
#

o

#

ok

#

1 sec

#

my pc is lagging

outer void
#

ok, now open a new cmd in your project folder and type npm install again

leaden inlet
#

running

outer void
#

its important to close all opened cmd everytime you install a new software/library

leaden inlet
#

noted

lyric mountain
#

also important to always check the version after you install anything

#

to see if the PATH was defined correctly

leaden inlet
#

@outer void

outer void
#

go to your environment variables and print the paths that are there

leaden inlet
#

like the directory

#

?

outer void
vivid fulcrum
#

why not just install build tools

#

and have it configure everything for you

leaden inlet
vivid fulcrum
#

(the command to install windows-build-tools needs to be run in an admin instance of powershell)

leaden inlet
#

@outer void

#

what do i edit

outer void
#

on "User variables for benra" click on Path and then Edit and print it

leaden inlet
outer void
#

yeah...

leaden inlet
#

where do i print

outer void
#

install windows-build-tools as mentioned above

leaden inlet
#

how?

outer void
#

google it

#

I cant provide the link rn

leaden inlet
#

alr

sudden geyser
#

installing...

leaden inlet
#

my pc just fucking restarted

#

it takes ages g

#

omg

#

it’s doing an update too

outer void
#

guys, im using discord.js (^12.5.3) with Typescript for my bot. The problems is that the command send() is not working on discord v12 when I try to use it with guildMemberAdd:

client.on("guildMemberAdd", async (member) => {

    const channel: GuildChannel | undefined =
        member.guild.channels.cache.get("841825479937359935");

        channel?.send("Welcome");
});

//Returned error
Property 'send' does not exist on type 'GuildChannel'

#

anyone else having this issue?

lyric mountain
#

guildchannel doesn't mean it's a textchannel

#

so it doesn't have a send method

#

also can't u do GuildChannel channel = ...?

#

like, that looks verbose af

outer void
#

its Typescript and implicit declarations aren't recommended

lyric mountain
#

that ain't implicit

#

implicit would be const channel = ...

#

implicit = not explicitly stated

#

well, looks like you can't

outer void
#

its not possible to create "GuildChannel channel"

lyric mountain
#

yeah, seached about it

#

that sucks

outer void
#

yeah haha

lyric mountain
#

anyway, don't use GuildChannel

#

use TextChannel

shadow stratus
#

what is typescript used for?

proven lantern
lyric mountain
#

typed javascript

shadow stratus
#

isn't js better? idk i've only ever cared about node

lyric mountain
#

nope

#

js is shitty when it comes to debugging, just because of its dynamic typing

#

like

sudden geyser
#

Kuu have you learned the way of javascript yet

lyric mountain
#
let a = "something";

a = 1;
console.log(a);
shadow stratus
#

that logs 1

lyric mountain
#

this is so shit for debugging that I can't even start to explain why

sudden geyser
#

I don't see what's wrong with it.

lyric mountain
#

like, you don't know the type beforehand

#

and intellisense sometimes weirds out

#

also compiler doesn't help shit

outer void
weak gyro
#

Never gonna give you up

#

Never gonna fart

shadow stratus
#

i personally hate types

weak gyro
#

:p

lyric mountain
shadow stratus
#

isn't java just javascript with types? i haven't used java in 4 years correct me if i'm wrong

sudden geyser
#

They're both very different.

lyric mountain
#

do you wanna be die?

#

it's like comparing car with carpet

weak gyro
#

Yes

shadow stratus
#

guess i'm gonna die then

weak gyro
#

Mee too

sudden geyser
#

Comparing Java to JavaScript is like comparing a $1 bill and $100 bill and saying they're the same

weak gyro
#

Lets die togwthwrye6w

sudden geyser
#

except you don't know the value of which one

lyric mountain
#

javascript is only called like that because it was born as a browser extension of java

#

but they took WAY different paths

shadow stratus
#

i'm only talking about syntax

lyric mountain
#

even syntax is totally different

outer void
#

even syntax

sudden geyser
#

Mocha was a much better name for JavaScript

#

JS is more dynamic / functional

lyric mountain
#

more milk

#

java would be called expresso then

#

and typescript would be latte

shadow stratus
#

I don't get why someone would like types

lyric mountain
#

jsfuck would be descafeinatto

sudden geyser
#

Types are useful for verifying something's correctness.

lyric mountain
#

who the hell drinks coffee without coffee?

leaden inlet
#

im back

#

pc was infected

proven lantern
#

otherwise types are useless

shadow stratus
#

pretty much

sudden geyser
#

Take this function for example: ```js
function isGreaterThanFive(number) {
return number > 5;
}

You can call this function in a lot of weird ways. A type-safe language may require it be written like this: ```js
function isGreaterThanFive<T: Comparable>(number: T) -> Boolean {
  return number > 5;
}```
#

This definition would require the input be comparable (so stuff like > can be used).

shadow stratus
#

i'm currently learning solidity, and it has types.. and now I realise that solidity syntax already looks better than typescripts

lyric mountain
#

tbf, I do hate ts type declaration

#

if it was java-like it'd be just Class name = something

#

instead of let name: Class = something

sudden geyser
#

T variable = t 🤮

outer void
#

after working with TS for some time i found it ok

shadow stratus
#

in solidity you can say function isGreaterThanFive(uint number) returns (bool){return number > 5}

#

looks wayy more simple than ts

sudden geyser
#

For human readability? Sure. But I don't mind either one.

#

Like the function keyword being called fn, fun, func, fctn, etc.

#

(Rust, Kotlin, Swift, ???)

outer void
#

Dart's syntax is pretty easy

#

its like C++ with Java

sudden geyser
#

Dart expects you to know other languages to learn its syntax though

outer void
#

I absolute loved it

sudden geyser
#

I semi-like Dart's syntax.