#development

1 messages · Page 1939 of 1

earnest phoenix
#

So if i use module and reward every 10 levels, how would you suppose I give them pre determined rewards

#

so say at level 20 I wanna give them access to mine for more things

quartz kindle
#

you need to use fixed milestones for that

earnest phoenix
#

I see

quartz kindle
#

modulo would be for infinite repeatable ones

earnest phoenix
#

Could I use a mix?

quartz kindle
#

sure

earnest phoenix
#

So at a certain point it just uses the modulo system once stuff runs out to give

quartz kindle
#

ye

earnest phoenix
#

Do you think if I wanted to add more items to give it would be complicated to switch between the two?

quartz kindle
#

if(10) else if(20) else if(50) else if(100) else if(level % 25)

earnest phoenix
#

Do you think using switch statements here would be easier ?

quartz kindle
#

yes it would be a good idea

#

you can run the modulos in the default case

earnest phoenix
#

Yea

#

i was thinking that

#

so I could do something like

#
switch(currLevel){
  case 10:
    //give rewards for reaching 10
  case 20:
    //give rewards for reaching 20
  default:
    //do the if statement?
}
#

and if I wanna add more items I can just go in and add another case statement

quartz kindle
#

sure

earnest phoenix
#

Alright makes sense

#

Thank you tim

quartz kindle
#

👍

earnest phoenix
#

o also should I raise the amount of xp earned each level?

#

or is it fine to keep it at 10-15

quartz kindle
#

a small growth curve like this one is better suited for unchanging amounts of exp

earnest phoenix
#

Alrighty then

delicate shore
#

Guys

#

I need help

#

I am using Typescript

#
import keys from '../db_models/keys'
#

I get an error

#

Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type

#
import mongoose from 'mongoose'

const new_keys = new mongoose.Schema({
    key:{
        type: String
    },
    email: {
        type: String,
        required: false
    }
 });
 
export default mongoose.model('latest api', new_keys);

my keys.ts

pale vessel
#

Did it literally say module-name?

delicate shore
#

no

pale vessel
#

Forget that. I don't see any import of module-name anywhere in that file

delicate shore
#

and I am so stupid I figured it out

#

I was using .js as the extension lmao
this is my first project in ts

pale vessel
#

Ah

delicate shore
#

but now I get this

pale vessel
delicate shore
#
 const MessageModel = module.exports = mongoose.model('latest api', new_keys);
#

should I do ts export default mongoose.model('latest api', new_keys)

pale vessel
#

You don't use module.exports in TS

delicate shore
#

ight

#

thanks

pliant eagle
#

new to js because python is trash, so for example if i got ```js
const embed = new MessageEmbed().setTitle('ur mom')

how am i supposed to reply to a slash command with a embed
```js
interaction.reply({
    //idk
})
pliant eagle
#

thanku flaz ❤️

pale vessel
#

+1

earnest phoenix
#

someone who agrees python is trash

#

but js is trashier so

pliant eagle
#

nah fuck python i remake world in js

pale vessel
#

Whatever happened to your old account?

delicate shore
#

Also, how do I use env with typscript

pliant eagle
#

i can't get into it cuz 2fa

#

locked out

pale vessel
#

Import dotenv and use dotenv.config()

pliant eagle
#

@limber flume rip

pale vessel
#

Should've used Authy

#

Or backup your codes

pliant eagle
#

i was using olly's app

earnest phoenix
#

shouldn't have used 2fa in the first place

pale vessel
#

Nah you should use 2FA

earnest phoenix
#

don't have a password, never get locked out

pale vessel
#

If you lose access then it's skill issue

#

Do you use 2FA now?

pliant eagle
#

olly's app idk what happened to it

#

and yeah 2fa always lmfao

earnest phoenix
#

but no longer

pale vessel
#

Okay then take backups

pliant eagle
#

i did have discord_backup_codes.txt but i reset my computer ages ago

delicate shore
pale vessel
#

Import it

earnest phoenix
pale vessel
#

import * as dotenv from "dotenv";

pliant eagle
earnest phoenix
delicate shore
#
dotenv.config();
pale vessel
#

They don't have a default import

pliant eagle
#

i've contacted discord support they should remove 2fa from my account if they dont ill get mad

earnest phoenix
#

They only have a default export

#

Named exports are created at runtime

timber fractal
#

thanks :)

pale vessel
#

You're right

delicate shore
#

Also i had another doubt

#

nvm

earnest phoenix
#

node version manager or never mind?

delicate shore
#

Can I do this- ```ts
process.env.something! as Number

pale vessel
#

But all envs are always strings

#

You should cast it to number

earnest phoenix
#

Number(process.env.something)

#

¯\_(ツ)_/¯

pliant eagle
#

n'd why does this not work

#

dumbass shuana forgot sum, lemme recheck

delicate shore
#

rhanks

earnest phoenix
#

what is the difference between +string, parseInt(string, 10) and Number(string)

timber fractal
#

oh yeah sorry, i said it was all but it had html tags too 🤦‍♂️

earnest phoenix
#

aside from the fact parseInt doesn't give decimals

pale vessel
#

You just said the difference yourself

earnest phoenix
#

aughel's website uses an article instead of a body tag

pale vessel
#

Also TS gets mad if you use +string

#

And parseInt() allows you to provide a radix

#

Number is always decimal

earnest phoenix
#

parseFloat too

delicate shore
#

what's the difference b/w npm i module and npm i --save module

earnest phoenix
#

iirc old npm installs it to global

#

--save means it always installs to your current node modules

delicate shore
#

ohhhh

#

ok

pliant eagle
#

im dumb i had the commandName different from what it should have been KEKW

delicate shore
#

Hi guys

#
const rateLimit = require("express-rate-limit");

const limiter = rateLimit({
  // ...
});

exports.getLimiter = () => limiter;
#

I am trying to convert this to typescript

#

and I keep getting stuck at the last line

#
exports.getLimiter = () => limiter;

If I do ```ts
export default {limiter}

it doesn't work
pale vessel
#
export default function() {
    return limiter
}```
delicate shore
#

and if I try export default function, it gives error

pale vessel
#

Or an arrow function

delicate shore
pale vessel
#

What error?

delicate shore
#

it says - "Did you mean Function"

#

and when i change it to Function, I get an error

#

that expected "," or something

pale vessel
#

Can you show your current code?

earnest phoenix
pale vessel
#

Nah

delicate shore
#

I sm stupid it worked thanks

timber fractal
delicate shore
#

Ts seems tougher than i anticipated

delicate shore
#
const normal_min = rateLimit({
    max: function(req, res) {
        if(req.query.api_key === 'api_key_A')
          return 1000;
        }
        if(req.query.api_key === 'api_key_B')
          return 5000;
        }
        // fallback
        return 1
})

I am getting errors here
what I dont understand is, how tf do functions work here in ts
is this not the correct way to do them or what

pale vessel
#

What errors doe

delicate shore
#

what even is this 😩

pale vessel
delicate shore
#

bruh

pale vessel
#

Your function only returns numbers so that should work

delicate shore
#

I fixed it

#

problem was with a }

#

why am I so stupid 😩

pale vessel
pliant eagle
delicate shore
#

how to export multiple functions at the same time

#

I meant in typscript*

pale vessel
#
export function a() {}

export function b() {}```
#

Or ts export default { a: function A() {}, b: function B() {}, }

earnest phoenix
delicate shore
#

yees

#

thanks

earnest phoenix
delicate shore
#

const isMega = (key: string) => {
}

export default {
    isMega,
}

can this work as well

#

its not

pale vessel
#

How did you import it?

delicate shore
#
import {
  isMega,
} from "../checkers/plan";
pale vessel
delicate shore
#

can I use it with export const fun = (a,b) =>

pale vessel
delicate shore
#

didnt work

#

wait it did work

#

but

feral aspen
#

I have this array of objects, and let's put the array in a variable named as res.

[{ following: [], }, { following: [ '528256079101034506' ], }, { following: [ '528256079101034506' ] }, { following: [ '528256079101034506' ] }, { following: [ '528256079165983231' ] }]

How can I get the count of following that is equal to 528256079101034506? I found this hard since you need a lot of mapping but I got lost.

delicate shore
#

Since this is an array, you can also use a forloop

feral aspen
#

I'm using .map(), but am I supposed to be using a for loop inside a for loop?

delicate shore
#
let count;
for(i=0;i<res.length;i++){
// Check if following is whatever you want
// If it is
// Then add 1 to the count
count++
}
#

this might not be the best way

#

and I am no amazing at programming

#

but I would use this as it looks easier

feral aspen
#

I can do this: .map((x, i) => ...).

cinder patio
#

what exactly do you want to do?

feral aspen
#

How can I get the count of following that is equal to 528256079101034506? I found this hard since you need a lot of mapping but I got lost.

pale vessel
#

Mapping? Sounds like you just need array.find()?

feral aspen
#

.. but that doesn't seem efficient. Eyes

cinder patio
#

A single for loop is the best you can do, and also that's not right

#

you aren't checking if the following array has the id

feral aspen
#
let count = [];
for (let i = 0; i < res.length; i++) {
    count.push(...(res[i].following))
};
count = count.filter(x => x === "528256079101034506");
console.log(count) // count.length = 2;
cinder patio
#

A single for loop would be better

feral aspen
#

That is what I did?

cinder patio
#
let count = 0;
for (const entry of res) {
     if (entry.following.includes(id)) count++;
}

In your code you create 2 extra arrays

feral aspen
#

Ah, we used a for of loop, I forgot about that.

timber fractal
#

wtf, now my preview just works without any meta data

feral aspen
cinder patio
#

you can also use reduce

res.reduce((acc, val) => acc + +val.following.includes(id), 0);
#

Not really, you are creating two unnecessary arrays

cinder patio
#

reduce might be the fastest

feral aspen
marble juniper
#

the acc starts at 0 because of the second argument in the reduce function

#

lol

feral aspen
#

So the two +s are normal, right?

cinder patio
#

yes

marble juniper
#

check the mdn docs for what the reduce function actually does

#

if you wanna know

cinder patio
#

the second + turns the boolean to a number

#

0 false 1 true

feral aspen
#
let count = 0;
const promise = new Promise((resolve) => {
    Social.find({
        lb: 'all',
    }).exec(async (error, res) => {
        if (error) console.log(error);
        for (const entry of res) {
            if (entry.following.includes(user.id)) count++;
            // console.log(count);
        };
    });
    resolve(null);
});
await promise;

console.log(count); // 0
#

Why does this return "0"?

#

The console.log(count) inside the for-of loop returns 0, 1, 2..

pale vessel
#

Resolve the promise inside the callback

#

If you put it outside it will resolve immediately

feral aspen
#

Ohh..

#

That worked, my bad on my side. Thanks!

timber fractal
#

no preview

#

tho it is exactly the same

#

does somebody know how i can fix that?

delicate shore
#

I need help again with ts

#

I am using node-fetch

#
const data = await response.json()
const raw_response = data[0]["cnt"]
#

this is how I get the response

#

but I get an error: Object is of type 'unknown'.ts(2571)

#

I tried declaring data as json

cinder patio
#

await response.json<ObjectThatDescribesHowTheDataLooks>()

delicate shore
#

ObjectThatDescribesHowTheDataLooks
I dont know what Object Describes how the data looks

cinder patio
#

maybe you have to pass the generics to the fetch method haven't used node-fetch in a while

delicate shore
#
const data = await response.json()as Array<any>;
const raw_response = data[0]["cnt"]
cinder patio
delicate shore
#

what about this

cinder patio
#

That's just avoiding type safety. Though in this context I guess it's not the worst if you can't be bothered to type the endpoint

delicate shore
cinder patio
delicate shore
#

god this is confusing

cinder patio
#

Javascript / JSON object:

  name: "Google",
  age: 101

typescript interface:

   name: string,
   age: number
delicate shore
#

I think I will use promise

#

that is easier

#

in promise it doesnt ask for all this

cinder patio
#

const data = (await response.json()) as any;

#

if you can't be bothered

delicate shore
#

thank god

#

thanks

feral aspen
#

How can you use the premium function in another file?

module.exports = bot => {
    async function premium(userID) {
        console.log("Hello");
    };
#

I did it like this, but is this an efficient way?

delicate shore
#

I know this is not the best solution, but you can attach it to your bot or client variable

#

for eg, just do client.something = premium

#

then call it from anywhere using client.something()

feral aspen
#

I don't think I'm trying to achieve that.

delicate shore
#
    async function premium(userID) {

If you make this a global function using what I am saying, you can just use it using bot.premium or whatever name you decide

feral aspen
#

I would've done something like:

module.exports = {
    premium: async function(userID) {
        console.log("Hello");
    };
``` But I needed to use `bot`.
cinder patio
#

you can make bot a parameter for the function

feral aspen
#

Oh, you're joking.

#

Wait, let me try..

feral aspen
delicate shore
cinder patio
#
module.exports.premium = function(bot, userId) {
            bot.doSomething(userId);
}

what's the function for?

#

also require(...).premium(...)

feral aspen
feral aspen
delicate shore
#
   `http://api.brainshop.ai/get?bid=${FREE_AI_BID}&key=${FREE_AI_KEY}&uid=${id}&msg=${msg}`
                                     ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/navdeepsharma/Desktop/Remaking-RSA/node_modules/nod

Why am I getting an error here

feral aspen
delicate shore
#

we cannot use $ in typscript?

#

but I am not even using require

#

see the line I am getting error at

cinder patio
#

man I feel like you're just overcomplicating everything. Just create a utils file, export all the functions from there and import then where you need them.

module.exports.fn1 = ...
module.exports.fn2 = ...
const { fn1, fn2 } = require("./utils");
#
module.exports.premium = function(bot, userId) {
     ...
} 
feral aspen
#

.. and I keep repeating module.exports for each function?

cinder patio
#
const { premium } = require("./utils");

...
premium(client, "123");
#

you can also do

module.exports = {
   fn1: () => ...
}

same thing

feral aspen
cinder patio
#

PUT IT AS AN ARGUMENT TO THE FUNCTION WHICH NEEDS IT

delicate shore
#

maybe

feral aspen
#

So when I call the function, I legit need to input bot, right?

delicate shore
#

i put it in the name lol

#

yes

feral aspen
#

(bot, ...)

feral aspen
cinder patio
#

Do you know what functions really are or are you using them blindly oop

feral aspen
#

Bruh, I'm back to square one.

#

You see how I did it?

cinder patio
#

Now show the code which imports the functions

feral aspen
#

A function needs bot and a function doesn't need bot.

cinder patio
#

and which calls them

delicate shore
#

im so done

earnest phoenix
#

move it outside of your module exports

#

try that

cinder patio
#

then it won't be exported?

feral aspen
#

GoogleFeud, I think I finally understood what you meant.

#

Hold on-

delicate shore
#

Im done
I am freaking done

#
his condition will always return true since this 'Promise<boolean>' is always defined.

30     if (isNormal(key) && !isPremium(key)) return 2500;
           ~~~~~~~~~~~~~
#
export const isNormal = async (key: string) => {
  const info = await keys.findOne({
    key: key,
  });
  if (!info) return false;
  else return true;
};
cinder patio
#

you don't await it

delicate shore
#

IT DOES RETURN FALSE IF I WANT IT TO

cinder patio
#

so it's always truthy

delicate shore
#

shei

cinder patio
#

even if you don't return a promise the function wraps all return values inside one because it's async

delicate shore
#

thanks

#

bruh

#

why

#
    `http://api.brainshop.ai/get?bid=${FREE_AI_BID}&key=${FREE_AI_KEY}&uid=${id}&msg=${msg}`
                                     ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/navdeepsharma/Desktop/Remaking-RSA/node_modules/nod````
#
  const response = await fetch(
    `http://api.brainshop.ai/get?bid=${FREE_AI_BID}&key=${FREE_AI_KEY}&uid=${id}&msg=${msg}`
  );
  const data = (await response.json()) as any;
  const raw_response = data[0]["cnt"];
#

this is all I am doing

cinder patio
#

what version of fetch are u using

delicate shore
#

3

cinder patio
#

version 3+ of node-fetch requires ESM imports

delicate shore
#

what does that mean

#

I am using ESM imports only

#

npm i -g pm2

cinder patio
#

not really because typescript compiles them to require

delicate shore
#

sudo npm i -g pm2

earnest phoenix
#

try restarting your console

delicate shore
#

ye

earnest phoenix
#

close then reopen it

delicate shore
#

anyway I can stop it from doing that

earnest phoenix
#

¯_(ツ)_/¯

#

don’t complain just accept it

cinder patio
#

I'd just use an older version of node-fetch or completely switch to another library

#

I switched to got

cinder patio
#

no

delicate shore
#

shit moment

#

axios ew

charred prairie
#

is there a good service where you can host a discord bot 24/7 ?

earnest phoenix
#

i love axios lmao

cinder patio
charred prairie
#

ok

delicate shore
#

bruh

charred prairie
#

ima try vps

delicate shore
cinder patio
#

javascript imports are a huge mess

delicate shore
#

yes

#
mongoose.connect(
  "",
  {
    useNewUrlParser: true,
    useUnifiedTopology: true,
  }
#

npx pm2

#

try running this

#

ok

#

what else can I say except

#

use brew

#

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

#

then brew install pm2

#

if it is there

#

actually nevermind

#

why sudio -i

#

Oh, but arent you the admin

#

since you have root access

#

sudo npm i @discordjs/opus should work

#

might ask for your password though ^

timber fractal
quartz kindle
#

dont use sudo for npm modules

sly sierra
#

why sudo

#

oh tim slready answered

#

sudo means super user do

#

and accessing your root dirs

#

which you dont wanna do

#

and node is located on the home dir which is without running as super user

#

just explaining if you dont know

quartz kindle
#

godzilla had a stroke trying to read that and fucking died

earnest phoenix
sly sierra
quartz kindle
wheat mesa
#

based tim

sly sierra
quartz kindle
#

xD

sly sierra
#

yea

quartz kindle
#

remember 10 years ago

#

when iphone was taking over the market

#

with it came a shit ton of fake iphones

#

"hiphone"

#

and people would buy that thinking it was the same thing

#

because nobody knew dafuq was an iphone exactly

#

just that it was something new and fancy

sly sierra
#

I was 4 or 3 years old at the time but hahah

quartz kindle
#

lmao

#

iphone was released in 2007

sly sierra
#

indeed

quartz kindle
#

its been 14 years already dayum

sly sierra
#

whic date though

#

like month

#

oh so i was a couple months old

#

@quartz kindle yess monospace for the font on your website

#

Monospace is really poggers

quartz kindle
#

lel

#

you just want to code, or do you want to actually host and run inside your phone?

sly sierra
#

you could use repl

quartz kindle
#

there are probably many code editor apps you can use

sly sierra
#

I think its mainly on android but yea.

quartz kindle
#

but to actually run the code you will likely need additional setup

sly sierra
#

I mean phones have terminals

quartz kindle
#

what most people do is run the code somewhere else, like a hosting service, a vps, an app container like heroku or repl.it

sly sierra
#

We dont spoon feed here

quartz kindle
#

do you have any coding experience?

wheat mesa
#

Replit is probably the best option from what it sounds like you’re looking for

quartz kindle
#

which programing language did you use?

#

alright, so you should be fine with repl.it

sly sierra
#
quartz kindle
#

repl.it is a website that hosts small apps and runs them for you, like a tiny server. they have an online code editor which you can use from your phone, no need to download anything

sly sierra
#

just a website

#

No if you already have knowledge of js then do you

#

I thought you were just starting coding so i sent you some docs

quartz kindle
#

what did you use to code your bot before? discord.js?

#

yes, but what did the videos show

#

did they use discord.js?

#

ok, but what did they install inside repl.it

#

discord.js?

#

lol

#

they surely start with "install this"

#

what did they say to install?

#

lel

#

well, then just go watch them again

#

repl.it can be used from your phone, so pretty much everything they show there will still work

#

unless they are using an outdated version

#

if you use repl.it you dont need anything else

#

you just code directly inside replit

sly sierra
quartz kindle
#

if you want to learn javascript, search for some videos about javascript

#

javascript as a language does not care what you use, its the same everywhere

#

there is no difference in mobile or pc

sly sierra
#

Yes

#

What?

#

You cant code without knowing how to code

#

Well you need coding skill and knowledge

#

No

quartz kindle
#

discord bots are like a specialization. you need to learn programming first, then you can chose what you want to specialize in

quartz kindle
#

for example, you want to be a javascript programmer, with a specialization in discord bots

#

so first step would be to learn javascript

#

and be very good at it

sly sierra
#

then move to discord,js

quartz kindle
#

the better you are at the language, the better bots you will make

#

and faster

sly sierra
#

indeed

#

Tim code tips

quartz kindle
#

again, if you want to host your bot on repl.it, you write the code inside repl.it

#

you dont need any other app

#

open the repl.it website in your phone, create a project, and start coding

sly sierra
#

yes

quartz kindle
#

if you want to learn javascript, look for videos that teach javascript, or check websites like codecademy or udemy that have programming courses

#

yes

sly sierra
#

both

#

look

quartz kindle
#

i dont understand what you're so confused about

sly sierra
#

You need to learn javascript or any lang to make a bot

quartz kindle
#

are you looking for something like an interactive tutorial videogame thing that teaches you js?

sly sierra
#

No

#

repl it is for writing the code then hosting it

quartz kindle
#

repl.it is not a teaching platform if thats what you're asking. but you can use repl.it as a testing ground to test stuff and learn by trying and experimenting, as well as to test code you see in teaching courses or tutorials

#

i have no idea what you're saying

sly sierra
#

mans brain went 🧠🧠💀

torpid marsh
#

Hello

#

Algum br pra me ajuda?

earnest phoenix
#

hi

#

yall bald

#

ok bye

dense flame
#

I dont quite understand the problem

torpid marsh
#

hello could someone help me with a question?
How do I get the bot to send an emoji or image in the message?

dense flame
#

why are you usiing string

torpid marsh
#

and if i want to put a server emoji how do i?

dense flame
#

you should use boolean

#

ik

#

this is like enabling the owoify right?

#

why not true and false mate

#

I mean thats not the problem but just weird

#

did you check the db if it actually changes on command?

#

put this inside an else

#

because you have an if above

torpid marsh
quartz kindle
#

you dont need the guild id

#

only the emoji id

#

all emojis are globally unique

torpid marsh
quartz kindle
torpid marsh
#

\🛠️

quartz kindle
#

that is not a custom emoji

#

only custom emojis have ids

#

for default emojis you use the unicode character directly in your code

#

for example

#
message.channel.send("🛠️")
torpid marsh
#

how do I get it to respond with emojis that haven't been added to the server?

quartz kindle
#

your bot needs to have the permission to use external emojis

#

and needs to be in the server where the emoji comes from

earnest phoenix
#

Are slash commands cached,since I have many guild only commands.I want to retrive them and loop through to get some infos(like guild)

tired panther
velvet pike
#

how can i get data with webhook on java

earnest phoenix
#

use php instead

severe perch
spiral timber
#

anyone here use a discord bot maker from steam?

earnest phoenix
#

what

earnest phoenix
spiral timber
#

yeah but you can still buy it and make a bot

storm belfry
#

by outdated he meant that it's not really recommended if you want to make a working bot

quartz kindle
#

discord bot maker's steam page

wooden ember
#

if ive downloaded the normal d.js node package can i also download the voise version too?

quartz kindle
#

does it even work?

wooden ember
#

or do i have to delete the existing d.js package

wooden ember
wooden ember
#

ah

quartz kindle
#

not a different djs version

#

so no, you dont need to uninstall it

wooden ember
#

yeah but on teh docs it says when you are setting up a bot you can iether install on or the other though

quartz kindle
#

its just a short cut for installing djs + addons

wooden ember
#

ah fair enough

earnest phoenix
#

you can still do some basic stuff

wooden ember
#

im pretty sure all that thing does it ctrl+v code into a file depending on what you want it to do

spiral timber
wooden ember
#

oh god

spiral timber
#

its not that bad it dosnt take alot of skill its alot eaiser than coding it

#

it automaticly codes it for you

wooden ember
#

i supose but then i've heard that the backend of that app is a mess so idk

spiral timber
#

idk like i like it but it dosnt have too many options so far i made kick ban warn check warns, youtube url VC music, rock paper scissors game, and other simple commands

#

for me its simple to use for someone who dosnt understand in coding. if i wanted to code it i would have to just to to that bots directory and the code is there

wooden ember
#

damn the yt player still works?

spiral timber
#

yeah

wooden ember
#

i have to update stuff on a monthly basis to keep my one working

spiral timber
#

what do you mean by that?

wooden ember
spiral timber
#

i did pay 10 bucks for it

earnest phoenix
#

any idea of single file, you can keep sync across many folders . Does gist support cli and is there the sub option(git inside git not possible without submodule).

wooden ember
#

huh?

#

i dont see why it wouldnt suport cli but idk much about that stuff

spiral timber
wooden ember
#

yeah thats what i mean youtube does that cuz if you watch a vid not through their platforms you bypass adds

spiral timber
#

for instance i tried converting a youtube to mp4 from a free youtube movie with ads and it will not work

wooden ember
#

yeah

spiral timber
#

but if a movie was uploaded on youtube but not by youtube by a ramdom channel it will then work

#

idk how it works exactly but all i know is there link is blocked

wooden ember
#

mmm thats odd

spiral timber
#

same with some copyright shit

wooden ember
#

yeah if its blocked in your country it wont work

spiral timber
#

im in the usa tho

wooden ember
#

or if you happen to live in the EU(or UK) you cant even watch age restricted videos

#

cuz papa govounment needs to make sure we arent naughty

spiral timber
#

lol damn yeah america dosnt care for that anymore lol

wooden ember
#

i know that s the way it should be

spiral timber
#

yeah

wooden ember
#

what ever happend to free choice over here i will never know

spiral timber
#

are you in the uk?

wooden ember
#

sadly

#

we left the EU but still have to share their crap legislation

spark flint
#

sadly

wooden ember
#

indeed

#

i was born in the US though and have a citezenship too so I will probably move back there when i have the money

#

i can go and live in a ranch in the midle of nowhere

#

thats off grid (exept for internet ofcource)

quartz kindle
#

yes but dont they use discord.js internally? 2017 is like djs v11

wooden ember
#

i mean considdering that yt still works on it

#

i would expect it hase to have been updated

#

also it really annoys me how error has 5 letters unlike all my other console logs

#

reeee

#

also i think ima have to update my vc player code for v13

#

sigh

earnest phoenix
#

How do I fix this error? I just wanted to update my Bot to discord.js V13, but if I want to start it, this show up.

RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.

#

pls provide your index.js or the client definition (new Client ..)

wooden ember
#

but that error means that you havent set any intents

earnest phoenix
#

Hi

jolly notch
#

What does discord use for websockets?

earnest phoenix
quartz kindle
jolly notch
quartz kindle
#

surely not

#

there is no way of knowing without them posting about it in one of their blogs

#

but im assuming either python, since most of their docs show python examples, or a lower level lang like rust or cpp because performance

jolly notch
#

Well it would be python for docs as it's simple to understand any concept with it

wooden ember
# earnest phoenix Tanks!

in d.js v12 you have const client = new Discord.Client() but in v13 its changed to something like ```js
const {Client, Intents} = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, MESSAGE.CONTENT] });

wooden ember
#

?

quartz kindle
#

everything else is personal preference

jolly notch
wooden ember
#

eh yeah i forgot about the bitfield thing but i prefer to have the words

#

I understand it easier

wooden ember
quartz kindle
#

an addon

wooden ember
#

nice

quartz kindle
#

const client = new Discord.Client({ intents: 32766 });

wooden ember
# quartz kindle an addon

ah yeah forgot i said i thought that i originaly though d.js voice was the same as d.js but with voice suport my bad

#

also you guys know the verbose logging that you can enable? is there a way to just extract some of the info from it?

#

cuz i would like to know the heart beat latency but i dont want it to spam my console

fading bobcat
#

How do I get my Port for
serverApp.listen('your port');?

wooden ember
#

the port you want the server to listen on

#

http is 8080 minecraft is 25565 depends on what you are doing

fading bobcat
#

Idk, I got a code and it says your port

#

Vote rewards for my bot

wooden ember
#

what the topgg api thing ?

fading bobcat
#

Ya

#

Lemme give full code

wooden ember
#

wait

#

there is a channel for the api

fading bobcat
#
const getDiamonds = await 
client.db.get("main", `diamonds_${u}`).then(d=>d ? d.value : 0);
client.db.set("main", "diamonds_" + u, Number(getDiamonds)+15)
})()
 })
serverApp.listen('ur port');  
wooden ember
#

bruh

#

i mean idk what to do with that cuz i dont use the api so eh

#

do you have to set up a dev account or somthing inortder to use the api ?

#

cuz if you do it might say there

#

but idk

solemn latch
#

Oh it was a topgg webhook CB_notlikethis
I thought the question was just about webhooks in general not topgg. My fault.

wooden ember
#

lol

#

i dont even know what webhooks are tbh

solemn latch
#

webhooks are a way for programs to communicate to each other

#

using standard http

#

for example, top.gg webhooks send messages to your code when someone votes, those messages contain these parameters. https://docs.top.gg/resources/webhooks/#schema
(who voted, what bot/server the vote was for, if it was a test vote or an upvote, if the weekend multiplier was applied, and some query information)

outer zenith
#

just curious what do yall use for data storage for ur bots

quartz kindle
outer zenith
coarse yoke
#

alot of things ;-;

outer zenith
#

im just trying to consider pro and cons of switching to mongo or some other db

coarse yoke
#

cant name all of them

sly sierra
outer zenith
#

like leveling

coarse yoke
#

😎

outer zenith
#

cause i feel for most things i can use sqlite

sly sierra
outer zenith
#

but leveling im not sure if sqlite is the best thing

sly sierra
#

Sqtile is also amazing

coarse yoke
#

ill go see how to use sqtile and maybe switch over to it

outer zenith
#

is just sql

#

w local db files

coarse yoke
#

nah not gonna switch over to it cuz i know how to use mongo better and its more like easy to use then sqtile but ill test sqtile

crisp lava
#

preferred coding languages? 🥸

sudden geyser
#

clojure

proven lantern
#

Tim told me my database was awesome yesterday

sly sierra
#

error?

#

oh

#

but it doesnt

#

nvm

woeful pike
#

= inside if statement?

#

I recommend installing eslint so it can catch these kinds of things for you

#

have you console.logged row?

#

oh no

#

don't store guild ids as numbers

sudden geyser
#

use strings!

#

or big numbers if you want

woeful pike
#

I mean your guildid is wrong

earnest phoenix
#

yes it is

woeful pike
#

it's truncated, look at the last two zeros

#

javascript can't represent numbers that large

#

you need to use strings or a bigint but that depends on the driver implementation

sudden geyser
#

Discord sends all IDs as strings

#

In your SQL database you'll probably save it as text

#

looks right

#

aw

earnest phoenix
#

v12 or v13?

#

why are you using v12 d.js

outer zenith
#

im rewriting my bot code to make it cleaner but i really dont know why my bot isnt even reacting to messages 💀

#

like in the on message event

#

any idea where the error could be (like what region of startup)
cause i can send sses as needed

#

but the bot runs the on_ready event

#

but doesnt recieve a on message event

earnest phoenix
#

do u have the message content intent activated?

outer zenith
earnest phoenix
outer zenith
#

but im looking at the discord dev portal

#

but yea it doesnt work even with it enabled

earnest phoenix
outer zenith
#

nvm i had a task created that had no sleep period

quartz kindle
#

whats your current code?

main trench
#

Weird question but can bots create webhooks? Didn't see anything on the docs about it so I assume not?

#

Still hope then

#

Dope

#

Just gotta figure out how then

cinder patio
#

Does anyone do code golf?

proven lantern
sudden geyser
#

gets rid of bottom rows boom

proven lantern
#

no

#

keep the buffers

#

and the dragon

cinder patio
#

What does the code do, prints the dragon?

#

(that's a dragon?)

solemn latch
#

I'll delete a random character ez

proven lantern
sly sierra
sudden geyser
#

the dragon is made from 100 languages

#

or 52

#

can't remember

proven lantern
#

This is a Ruby program that generates Rust program that generates Scala program that generates ...(through 128 languages in total)... REXX program that generates the original Ruby code again.

sly sierra
#

Damn you must have a lot of time on youir hand

proven lantern
#

i could never make this

sly sierra
#

copy and paste

sudden geyser
#

I feel bad for the build process

#

imagine trying to run that thing

proven lantern
#

just need to install a few languages

sly sierra
#

What IDE do you guys use

#

I'm just a curios guy

sudden geyser
#

visual studio code

#

and sometimes sublime

solemn latch
#

Arduino ide

proven lantern
#

intellij

sly sierra
earnest phoenix
sly sierra
#

ah yea

quartz kindle
#

you're code is still that? because this is very wrong

cinder patio
#

Has someone solved the bottles of beer one

sly sierra
#

@earnest phoenix I would love to help with your problem or try but I'm really tired and don't wanna sleep.

earnest phoenix
#

im trying to make a new bot and i have my script all typed out and no errors but in the console it gives me this error. Anyone know why?

light epoch
#

You need nodejs v16 or newer

proven lantern
#

if i want to schedule an aws lambda event to run in the future should i use sqs?

#

maybe there's a way to use cloudwatch

#

sqs doesn't like waiting

proven lantern
#

cloudwatch does reoccurring events. i just want to schedule unique events to run in the future

#

why hasn't amazon made a feature to schedule lambda executions in the future?

proven lantern
#

why is it so hard to schedule a lambda

earnest phoenix
#

I'm getting error like this user aborted a request, how can I fix this? i am using d.js v13

lament rock
#

Its an issue with either Discord's Rest or network fidelity on your end

#

or your process is locked and the abort controller triggers

earnest phoenix
lament rock
#

Then it's Discord

earnest phoenix
#

Yes response

#

Thats weird

whole glen
#

IDK why this does not work```
const keepAlive = require("./server.js")
//discord.js for using the bot for discord
const Discord = require('discord.js');
//discord client
const client = new Discord.Client();

//keep alive
keepAlive()

client.once('ready', async () => {
const rules = new Discord.MessageEmbed()
rules.setTitle('Rules')
rules.setColor('#FF0000')
rules.addFields(
{ name: '1. Treat EVERYONE with respect and Kindness.', value: 'Don't ruin someone elses day when you are having a bad day or not.', inline: false },
{ name: '2. No politics.', value: 'This includes talking about the prez and laws.', inline: false },
{ name: '3. NO NSFW content!!!', value: 'This includes Nudity, Gross things, Blood and Dead animals.', inline: false },
{ name: '4. 100% NO racism or discrimination allowed. This includes jokes/memes.', value: 'Don't make fun or joke about Gay people, People of color, People with disability, etc.', inline: false },
{ name: '5. DO NOT spam and keep CAPS to a minimum.', value: 'Spaming is useless and bad. CAPS is annoying.', inline: false },
{ name: '6. FOLLOW server RULES when chatting in DMs with other server members.', value: 'Unless they are your friends and they are okay with you not following these rules.', inline: false },
{ name: '7. The rules for this server may change at ANY TIME and it's YOUR responsibility to look at the changes and follow them.', value: '', inline: false },
{ name: '8. ONLY speak in ENGLISH!!! as we only know English and we don't know what you say.', value: 'You can talk about a languge. Just dont speak it.', inline: false },
{ name: '9. No Scamming.', value: 'No BAD/sus links.', inline: false },
{ name: '10. No begging.', value: 'We don't like it a lot.', inline: false },
{ name: '11. No advertising.', value: 'This means no discord invites.', inline: false },```

#

      { name: '12. Use the correct channel.', value: 'Unless it\'s relevant to the current conversation.', inline: false },
      { name: '13. Keep swearing to a minimum', value: 'DON\'T say the N or B word.', inline: false },
      { name: '14. Follow Discord TOS and Guidelines.', value: '(https://discord.com/terms | https://discord.com/guidelines)', inline: false },
      { name: '15. DON\'T ping someone for no reason!!!', value: 'No mass pinging.', inline: false },
      { name: '16. Use some common sense.', value: 'That\'s common sense.', inline: false },
      { name: 'Warning ⚠️: we look at all deleted messages so be careful about what you say/do. OR ELSE.', value: 'From staff: wahahahahahahahahahaha.', inline: false },
      { name: 'You will not be banned for using betterdiscord.', value: 'Not like Z1\'s server', inline: false },
    )
    rules.setTimestamp()
    rules.setFooter('Thank you - STAFF');
  client.channels.cache.get('843188262700056606').send(rules)
  
  const updatedrulesmessage = new Discord.MessageEmbed()
    updatedrulesmessage.setTitle('Rules have been updated!!! Please go and review them!!!')
    updatedrulesmessage.setColor('#FF0000')
    updatedrulesmessage.setTimestamp()
  client.channels.cache.get('842129930410000425').send(updatedrulesmessage + "[#843188262700056606](/guild/264445053596991498/channel/843188262700056606/)")
  client.channels.cache.get('846199943172980736').send(updatedrulesmessage + "[#843188262700056606](/guild/264445053596991498/channel/843188262700056606/)")
});

client.login(process.env.TOKEN)``` 
i GET ```(node:1077) UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.```
solemn latch
#

rule 7 value is empty

proven lantern
neat ingot
#

is that using one of those fancy fangled 'serverless' type functions?

proven lantern
#

all this just to schedule the lambda

sudden geyser
#

Whatever happened to thread.sleep()

proven lantern
#

whatever happened to goto

sudden geyser
lyric mountain
#

Who tf uses goto

#

Too basic

proven lantern
#

whatever happened to asm

sudden geyser
#
function f() {
  console.log("Goto!");
}

f(); // switched! wwoo!!!!!!!
proven lantern
#

true

#

we should learn machine code

lyric mountain
#

Imagine in a near future machines learning human code

proven lantern
#

neuralink

sudden geyser
#

well I still want a job

proven lantern
#

i want ai to do all jobs for me

sudden geyser
#

GitHub is just Microsoft's late-game embrace, extend, extinguish.

proven lantern
#

and i get to do whatever i want all the time

lyric mountain
#

But wouldn't that be

#

SOCIALISM???!!

proven lantern
#

the ai own themselves

#

there will be google ai bots running around helping people and giving them ads

lyric mountain
#

I came

#

Wassup

sly sierra
lyric mountain
#

Console.log row.owo

#

U don't need to === true also

proven lantern
#

is it true or "true"

sly sierra
#

true*

proven lantern
#
row.owo === "1"```
#

not true

lyric mountain
#

Ye, '0' is true

proven lantern
#

0 is true?

lyric mountain
#

Cuz non empty string

proven lantern
#

oh

lyric mountain
#

0 isn't, '0' is

proven lantern
#

i thought you wanted 0 to be true

lyric mountain
#

'0' is a non-empty string, with is always true

#

0 is a numeric value, which is always false

proven lantern
#

parseInt("0") is false

lyric mountain
#

U could just parseint it

#

But whatever

gentle condor
#

how to add custom emoji in drop down menus discord py?

river star
#

jesus man

#

just do like

if (!row.owo) return
#

youre doing if row.owo == true

#

this would be cleaner

#

hold on

#
if (args[0]) return
if (!row.owo) return

embed.setDescption... rest
#

no need to put it all in a if statement

delicate shore
#

Hey guys I need a little bit help

#
const canvasMethod = async (req: Request, res: Response, next: NextFunction) => {
  let img1 = req.query.img1 || req.query.img;
  let img2 = req.query.img2;
  let img3 = req.query.img3;
  let txt = req.query.txt;
  let method = req.path.method
#

This is my code for canvasMethod function

#

in a file called canvas.ts

#

I get this error

#

But in my file called routes.ts
I am doing this: ```ts
router.get("/canvas/:method", controller6.canvasMethod, normal_min, normal_day);

This assures that the path method exists
pale vessel
#

What does req.path return?

delicate shore
#

haven't tried yet

pale vessel
#

Because it thinks req.path is a string, not an object

delicate shore
#

it is

#

maybe

#
console.dir(req.path)
// => "/users"```
#

express docs say this

pale vessel
#

That's a string

delicate shore
#

yes

#

but I remember using the same code

#

in javascript

#

and it worked

pale vessel
#

The value would've been undefined then

delicate shore
#

what do you mean.

delicate shore
#

yes

quartz kindle
#

req.params

#

not req.path

delicate shore
#

oh

#

thanks

proven lantern
#

data: { message: 'Bots cannot use this endpoint', code: 20001 }

#

bots can do dms

#

what is it talking about

#

https://discord.com/api/v9/users/@me/channels

#

nm, i messed up

gentle osprey
earnest phoenix
earnest phoenix
#

Looks like aiohttp

gentle osprey
gentle osprey
young rune
#

Free nitro

#

I want

lament rock
gentle osprey
young rune
gentle osprey
earnest phoenix
pale vessel
#

OhINep

frosty valve
#

Rq question as I don’t find anything online. Does babeljs add type check on compiled code for params?

pale vessel
#

No

#

You have to add them yourself I'm pretty sure. the compiler isn't that smart

frosty valve
#

It isn’t too hard for the compiler to add it tho tbh

#

just add some error logging code if the param doesn’t match the type when compiling it.

#

Well. Thanks for a answer anyways

dusk skiff
#

why does this not work? it return undefined

axios({
    url: `/users/655881699304931368`,
    method: 'GET',
    baseURL: 'https://discord.com/api/',
    headers: { 'Authorization': `Bot ${config.discordBotConfig().token}` },
    responseType: 'json'
})
.then(function (res) {
    return res;
})
lament rock
lament rock
#

Idk about that one chief

earnest phoenix
timber fractal
spark flint
harsh tusk
#

<button> is not working for me

earnest phoenix
#

why doesnt this work? the interaction fails when I click on the button

#

nvm it's working

sly sierra
#

nice

fiery copper
#

TIL. That in Discord.js 13 message.reply now actually replys instead of Mention, message content

timber fractal
#

ive added SSL for all of them

last tapir
#

i have an array

const l = ["ooo", "lol", "hahaha", "ok"];

how can i get the string "lol" and remove it?

#

should i use filter or something

timber fractal
tulip ledge
timber fractal
spark flint
#

I'm geniunely confused as to why it doesn't work

timber fractal
#

no-one knows :((((

tulip ledge
#

Are u sure all those images exist?

spark flint
#

yeah

#

thats the url

tulip ledge
#

And thats supposed to show when you send your website url on discord right?

spark flint
#

@timber fractal do you have an anti vpn or something

#

i think i might know

#

i tried to access using a vpn, site blocked me

#

the discord scraper to get embed details might be getting blocked

spark flint
#

i tested with the code and it works for me

tulip ledge
#

Maybe try changing type to image?

#

Idk

#

Never used it before

spark flint
#

Its not that

tulip ledge
#

Reading the docs atm

spark flint
#

its the exact same code on their site

tulip ledge
#

Huh

#

So it works fory ou

#

But not for them

spark flint
#

yep

#

i think its the vpn thing

#

i tried to access using a common vpn

#

didn't work

tulip ledge
#

Yeah I thibk so

spark flint
#

but when disabled it didn; work

timber fractal
tulip ledge
#

That’s the only thing that could possible interfere with that I think

spark flint
#

yep

timber fractal
#

how tf do i remove that

spark flint
#

what host do you use

timber fractal
#

mijndomein

#

dutch domain managing

#

and you can get hosting

tulip ledge
#

You’ll need to resolve it with them

timber fractal
#

from them

timber fractal
spark flint
#

I'm looking now

#

that might be something

timber fractal
#

when my friend left his vpn on

#

and tried visiting my site

#

it wouldnt let him

spark flint
#

yeah

opaque acorn
#
npm WARN tarball tarball data for prism-media@https://codeload.github.com/distubejs/prism-media/tar.gz/main (sha512-lkEYKsA09+XkKqQHHK96cpmzJE3rlIoMHYww0gfS4Vodz/ZS2p/4Bt09xAqRoHpUEihbO+KdaOFGOypBdBaz7Q==) seems to be corrupted. Trying again.
npm WARN tarball tarball data for prism-media@https://codeload.github.com/distubejs/prism-media/tar.gz/main (sha512-lkEYKsA09+XkKqQHHK96cpmzJE3rlIoMHYww0gfS4Vodz/ZS2p/4Bt09xAqRoHpUEihbO+KdaOFGOypBdBaz7Q==) seems to be corrupted. Trying again.
npm ERR! code EINTEGRITY
npm ERR! sha512-lkEYKsA09+XkKqQHHK96cpmzJE3rlIoMHYww0gfS4Vodz/ZS2p/4Bt09xAqRoHpUEihbO+KdaOFGOypBdBaz7Q== integrity checksum failed when using sha512: wanted sha512-lkEYKsA09+XkKqQHHK96cpmzJE3rlIoMHYww0gfS4Vodz/ZS2p/4Bt09xAqRoHpUEihbO+KdaOFGOypBdBaz7Q== but got sha512-nLwwM6M/qz+VZ0LNzfcKrEwojdgEH5lGZDPaBpXp75gNeTEQ95ysj1QHbCUWHTLoC+fPJJ5Io13pe4RtQBmyTw==. (9770 bytes)
#

???

tulip ledge
last tapir
#

yes yes i didnt read my bad

lament rock
opaque acorn
#
["command_handler", "event_handler"].forEach(handler => {
                                     ^
TypeError: Cannot read properties of undefined (reading 'forEach')
at Object.<anonymous> (/app/index.ts:25:38)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47
quartz kindle
#

what the fuck, that error is literally impossible

cinder patio
#

It happens inside the foreach

#

the error just points where the function starts, which is pretty weird

#

show the entire function

opaque acorn
cinder patio
#

the errors is probably in one of the functions you're calling, then

simple stump
#

How would I use canvas arcs to create a “leveling circle”? I am having trouble with the math for circles. The leveling is shown on the circle, but not at the correct length. I messed around a bit on w3schools, but since the canvas is 3k x 2k (a mistake by me lol), the math seems to be a bit different. I got as much as:
ctx.arc(1926, 300, 125, 0, (amountToNextLevel ) * 10);
Assuming amountToNextLevel is experience / experienceForNextLevel
One example is the image attached. bwepis has 32288 experience, but at level 4, level 5 requires 64000 experience. This means he should be about halfway through the arc, but for some reason it shows he’s 3/4 of the way there. I have a few other examples as well if you want to see.

Code:
https://sourceb.in/xBQqnSYvMC

solemn latch
simple stump
solemn latch
#

Are they all 3/4th of a circle

simple stump
#

The experience for each person changes, but requirements for the next level is the same

simple stump
solemn latch
#

So, what it seems is going on is you are not calculating radians

#

(sorry just now sat at my computer and could look at the code)

#

not the cleanest way to do it, but can kind of point you in a rough direction.

#

(also added a closepath, just for visibility, obviously you don't want that)

#

notlikenoot i actually messed that up, silly me

delicate shore
#

guys

#

why isnt my node project working when I run node .

solemn latch
#

wrong file name in your package.json?

delicate shore
solemn latch
#

in the wrong folder?

delicate shore
delicate shore
solemn latch
#

do you have anything in your code that logs every time?
or I guess what I am asking is if your project has anything that forces it to stay on.

delicate shore
#

I dont know

solemn latch
#

add a console log to the very beginning of index.js

delicate shore
#

It basically is using nodemailer

#

and csv-parser

#

first it parses csv and saves it into an array

#

then emails are sent

solemn latch
#

yeah, it probably is just closing itself when done

delicate shore
delicate shore
#

because I am logging a lot of things

#

in the things

solemn latch
#

the console log at the beginning of the file works though?

delicate shore
#

yep

solemn latch
#

then somethings wrong with your code, the file is indeed running and closing itself when it finishes executing.

delicate shore
#

should I debug using console log

solemn latch
delicate shore
#

wait

#

tf

#

ok so here's the thing

#

everything is working when I am testing through console.log

#

except one function

solemn latch
#

are you calling the function?
I assume you are, but always gotta check

delicate shore
#

figured the issue

#

so what I was doing was

#

function() {
function()
}

#

I am dumb

solemn latch
#

👀

wooden ember
#

bruh

#

looks like somthing i would do though lol

#

also does anyone know what causes this?

#

trying to make my bot play music

#

it connects but at some point it times out or somthing