#development

1 messages · Page 1692 of 1

quartz kindle
#

require it

#

show the beginning of the mute command file

#

the first 5-10 lines

timber jolt
zenith terrace
#
const bla = require(`locatedSchema`)```
quartz kindle
#

so you need to require it

#

the same way you require other files

timber jolt
#

the thing about it is that where do i put it?

quartz kindle
#

at the beginning

zenith terrace
timber jolt
#

the the top?

#

when i do it says it cant find the module or sum

#

hold on

quartz kindle
#

do you know how modules work? youre already using them, you should know

#

module.exports makes the file importable
require imports the file

#
// file1.js
module.exports = something

// file2.js
something = require("./file1.js")
timber jolt
#

like this? const mutemodel = require ('schema file')

quartz kindle
#

yes

urban cape
#

how someone say what this practicly means:
.then(result1 => {
console.log(result1.id)
return result1.id
})

#

is it a function?

quartz kindle
#

a promise

timber jolt
#

do i keep the ('schema file")

#

or do i change it to mute?

quartz kindle
#

you put the path to your file

#

the file where you put the schema

urban cape
#

Is there a way to store a var in a .then() like 20times?

timber jolt
#

so my mutemodel

quartz kindle
#

yes

urban cape
#

I have like twenty times in a row .then
is there a way to store a var in that code then.

timber jolt
#

so like this ^

quartz kindle
#

yes but it needs to be the path to the file

#

do you know what are paths?

urban cape
#

you mean an other file?

timber jolt
#

no

urban cape
#

Then i dont

timber jolt
#

/model/muteModel?

sterile lantern
#

./model/mutemodel

rotund violet
quartz kindle
#

yes, but you need a relative path

sterile lantern
#

depends actually

#

are you in a folder?

#

is the file located in a folder rather

quartz kindle
#

./ means same folder
../ means previous folder

urban cape
#

relative path is a way to store, got it

sterile lantern
#

really?

timber jolt
#

um

#

hold on

sterile lantern
#

i thought ./ went outside of the folder

quartz kindle
#

so if you are in folder commands and the file is in folder models then you need to go to the previous folder

sterile lantern
#

i did ./Models/schema.js

#

and it worked

#

thonk

timber jolt
#

?

quartz kindle
#

no that will look for the file in the base folder of your computer

timber jolt
#

oh

quartz kindle
#

you need the dots to make it relative

#

try with ../

zenith terrace
quartz kindle
#

and your folder is named models, not model

#

the names of the folders and files need to be correct

timber jolt
quartz kindle
#

the names have to be correct

quartz kindle
timber jolt
quartz kindle
#

why the capital S

timber jolt
#

lol my bad

urban cape
#
fetch('https://discord.com/api/oauth2/token', {
            method: 'POST',
            body: new URLSearchParams(data),
        })
            .then(res => res.json())
            .then(info => {
                b = info
                return info
            })
            .then(info => fetch('https://discord.com/api/users/@me', {
                headers: {
                    authorization: `${info.token_type} ${info.access_token}`,
                },
            }))
            .then(userRes => userRes.json())
            .then(result1 => {
                console.log(result1.id)
                id1 = result1.id
                return result1.id
            })
            .then(console.log)
            .then(id => fetch("https://discord.com/api/guilds/828624028456583190/members/" + id1), {
            headers: {
                authorization: `${b.access_token}`,
            }
            }).then(result2 => {
            return result2})
        .then(console.log)
timber jolt
quartz kindle
#

should work

quartz kindle
#

just put everything in one then

urban cape
#

ow, is that a thing to

quartz kindle
#

dafuq

timber jolt
urban cape
#

only the last part i typed myself and that part wont work

timber jolt
quartz kindle
#

you'll need to ask people who use mongoose about that

urban cape
zenith terrace
#

this is why you never copy n paste big code you dont know

urban cape
#

Havent thought of that, but still how

timber jolt
quartz kindle
urban cape
#

can i jsut have one .then(var1 => {
all code

})
?

quartz kindle
#
  1. send request
  2. get result, convert result to json
  3. ??? what is info doing? this is not really doing anything
  4. use the info from the previous one (that you could have gotten from step 2) and make a new request
  5. convert the new request into json
  6. console.log the result then return the result again? what for?
  7. console.log it again and do nothing?
  8. now you have invalid data here
    ...
urban cape
#
  1.    b = var outside the chain so i can store it.
    
  2.  that last one i understand
    
quartz kindle
#

you cant store outside the chain

#

its async

onyx hare
#

im getting really annoyed with this, what part of the message.mentions.members.first() is undefined? this has been getting on my nervs for atleast 5 hrs now i see 0 problems, the bots sees a bajillion
TypeError: Cannot read property 'members' of undefined

const Discord = require("discord.js");
const { stripIndents } = require("common-tags");

exports.run = async (message, args) => {
if (message.deletable) message.delete();

        let Member = message.mentions.members.first() || message.guild.user.cache.get(args[0])

        if (!Member)
            return message.reply("Couldn't find that person?").then(m => m.delete(5000));

        if (Member.hasPermission("BAN_MEMBERS") || Member.user.bot)
            return message.channel.send("Can't report that member").then(m => m.delete(5000));

        if (!args[1])
            return message.channel.send("Please provide a reason for the report").then(m => m.delete(5000));
        
        const channel = message.guild.channels.find(c => c.name === "reports")
            
        if (!channel)
            return message.channel.send("Couldn't find a `#reports` channel").then(m => m.delete(5000));

        const embed = new MessageEmbed()
            .setColor("#E74C3C")
            .setTimestamp()
            .setFooter(message.guild.name, message.guild.iconURL)
            .setAuthor("Reported member", Member.user.displayAvatarURL)
            .setDescription(stripIndents`**- Member:** ${Member} (${Member.user.id})
            **- Reported by:** ${message.author}
            **- Reported in:** ${message.channel}
            **- Reason:** ${args.slice(1).join(" ")}`);

        return channel.send(embed);
}
quartz kindle
#

the outside doesnt exist anymore

#

if you want to interact with variables outside you need to use async/await instead

urban cape
#
But it kidna worked

http.createServer((req, res) => {
    }
    let responseCode = 404;
    let content = '404 Error';

    const urlObj = url.parse(req.url, true);
    if (urlObj.query.code) {
        const accessCode = urlObj.query.code;
        console.log(`The access code is: ${accessCode}`);
        var b = "";
        var id1 = "";
        // ...

        const data = {
            client_id: '757161884528148500',
            client_secret: 'xxxx',
            grant_type: 'authorization_code',
            redirect_uri: 'xxxxx',
            code: accessCode,
            scope: 'identify guilds.join bot',
        };
        fetch('https://discord.com/api/oauth2/token', {
            method: 'POST',
            body: new URLSearchParams(data),
        })
            .then(res => res.json())
            .then(info => {
                b = info
                return info
            })
            .then(info => fetch('https://discord.com/api/users/@me', {
                headers: {
                    authorization: `${info.token_type} ${info.access_token}`,
                },
            }))
            .then(userRes => userRes.json())
            .then(result1 => {
                console.log(result1.id)
                id1 = result1.id
                return result1.id
            })
            .then(console.log)
            .then(id => fetch("https://discord.com/api/guilds/828624028456583190/members/" + id1), {
            headers: {
                authorization: `${b.access_token}`,
            }
            }).then(result2 => {
            return result2})
        .then(console.log)
            
    }

    if (urlObj.pathname === '/') {
        responseCode = 200;
        content = fs.readFileSync('./index.html');

quartz kindle
#

it will only work if you dont need those variables anywhere in your code during the same function

#

because once you start a .then() without awaiting, the outside code doesnt exist anymore, its long gone

#

the variables will work if you only access them after some time

#

but they will not work if you try to access them immediately

urban cape
#

so i should put "await"?

quartz kindle
#

it would be way easier if you make everything into async/await

#
const info = await fetch(..., {...}).then(res => res.json());
const user = await fetch(..., {use info here}).then(res => res.json());
etc...
urban cape
#

thats really smart

quartz kindle
#

if you did it without await, like this, it would not work ```js
let info;
fetch(..., {...}).then(res => res.json()).then(i => info = i);
console.log(info)

#

because by the time the .then() finishes, the console.log doesnt exist anymore

urban cape
#

so i should use wait. got it

opal plank
#

that code is basically the definition of es4 code or callback hell

#

how many .then()'s did u add there

urban cape
quartz kindle
#

rewrite it with callbacks :^)

opal plank
#

you using var and then()

#

you can ditch both of those

#

also, isnt fetch() callback based?

quartz kindle
#

idk, i think it accepts both

crimson vapor
#

fetch returns a promise

timber jolt
#

can anyone here help me with this error?

crimson vapor
#

you cut off the error, right

opal plank
#
    if (urlObj.pathname === '/') {
        responseCode = 200;
        content = fs.readFileSync('./index.html');```
Reading files every request?
quartz kindle
#

ye its promise only

opal plank
#

if its promise its fine

timber jolt
lusty quest
timber jolt
#

yes

quartz kindle
#

imagine if fetch had callbacks, let me rewrite it

crimson vapor
#

please no

#

no no no

timber jolt
crimson vapor
#

don't

opal plank
lusty quest
#

how did you call the database?

opal plank
crimson vapor
#
            var current1 = result1[0].current; 
            var location = result1[0].location; 
            var current2 = result2[0].current; 
            var location = result2[0].location; 
            var current3 = result3[0].current;
            var current4 = result4[0].current;
            var current5 = result5[0].current;
            var current6 = result6[0].current;
            var current7 = result7[0].current;
            var current8 = result8[0].current;
            var current9 = result9[0].current;
            var current10 = result10[0].current;
            var current11 = result11[0].current;
            var current12 = result12[0].current;
            var current13 = result13[0].current;
            var current14 = result14[0].current;
            var current15 = result15[0].current;
            var current16 = result16[0].current;
            var current17 = result17[0].current;
            var current18 = result18[0].current;
            var current19 = result19[0].current;
            var current20 = result20[0].current;
            var current21 = result21[0].current;
            var current22 = result22[0].current;
            var current23 = result23[0].current;
            var current24 = result24[0].current;
            var current25 = result25[0].current;```
#

LOL

opal plank
#

yes

copper cradle
#

omfg

opal plank
#

lets not try to beat that one

crimson vapor
#

I saw someone do it actually

opal plank
#

it was here

#

not gonna point fingers

copper cradle
#

people not knowing loops exist is the best shit ever

crimson vapor
#

better I mean

opal plank
#

but it was definitively here

#

loops are for the weak

#

we use callback hells here

timber jolt
#

?

opal plank
lusty quest
opal plank
#

for loops are for the weak, smart people use while()

crimson vapor
#
if (args == '1 + 1') return '1 + 1 = 2'
if (args == '1 + 2') return '1 + 2 = 3'
if (args == '1 + 3') return '1 + 3 = 4'
...```
quartz kindle
#
fetch('https://discord.com/api/oauth2/token', {
  method: 'POST',
  body: new URLSearchParams(data),
}, res => {
  res.json(info => {
    fetch(..., {...}, res => {
      res.json(result1 => {
        console.log(result1);
        fetch(..., {...}, res => {
          res.json(result2 => {
            console.log(result2);
          })
        })
      })
    })
  })
})
``` :^)
urban cape
#

const info = await fetch('https://discord.com/api/oauth2/token', {
^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules
←[90m at Object.compileFunction (node:vm:355:18)←[39m
←[90m at wrapSafe (node:internal/modules/cjs/loader:1021:15)←[39m
←[90m at Module._compile (node:internal/modules/cjs/loader:1055:27)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1120:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:971:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:812:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m

crimson vapor
#

no

sterile lantern
#

you need to be in async

#

to use await

crimson vapor
#

atVeld please ban tim

urban cape
#

should i make the function asunc

opal plank
#

another amazing example of the pyramid

crimson vapor
crimson vapor
#

1 1 2 3 5 8

quartz kindle
crimson vapor
#

callback hell

quartz kindle
#

its unbeatable

#

every time i see it again i am amazed once more

opal plank
#

you can safely put fibonacci's pyramid in those callback hells

timber jolt
opal plank
#

though the numbers are the amount of space from the margin

lusty quest
urban cape
#

how do people make function async

lusty quest
#

add async to it

opal plank
#

but putting async to it

urban cape
#

where

opal plank
#

infront of it

crimson vapor
#

umm

lusty quest
#

infront of the function

crimson vapor
#

pascal triangle

opal plank
#
function Sync() {}
async function Async() {}
crimson vapor
urban cape
#

http.createServer ((req, res) => {}
Where accectly

opal plank
quartz kindle
#

async (req, res)

urban cape
#

thx

lusty quest
# timber jolt

the error is one a different position, it says mute.findOne not muteModel

#

did you uploaded the code to your VPS before running it again?

timber jolt
#

uhhhhhhh

lusty quest
#

or saved it before running

sterile lantern
#

did you even call mongoose

#

in your code

timber jolt
#

si

sterile lantern
#

can you send your code here

#

its hard to understand the issue

#

at least the const parts

lusty quest
#

its all fine, just some wrong name for a Model

#

causing Mongoose to timeout

timber jolt
#

thats the mute command

lusty quest
#

this is why i ask if he properly saved it

sterile lantern
#

arent you supposed to name the schema

#

like

#

MuteSchema.js

#

or no

#

i mean i dont think its required

lusty quest
#

why?

sterile lantern
#

idk i just saw most examples having Schema at the end

lusty quest
#

you can call the file donkey and export it as muteschema

sterile lantern
#

is the issue fixed

#

orr

lusty quest
#

no bcs i guess he forgot to save the file or forgot to upload it

#

the error says mute.findOne but the code he provided says now mutemodel.finone

timber jolt
#

i saved it

sterile lantern
#

try running it again

timber jolt
#

ight

sterile lantern
#

and see if the error persists

lusty quest
#

did you call the model somewhere else?

sterile lantern
#

wait

#

send your mute.js

#

the schema

urban cape
#
Ehm, any idea?

  [Symbol(Response internals)]: {
    url: 'https://discord.com/api/guilds/828624028456583190/members/372063501755088896',
    status: 401,
    statusText: 'Unauthorized',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}
timber jolt
#

same thing

sterile lantern
#

wth

#

theres no mutes.findOne() in ur code

lusty quest
#

you call somewhere the wrong model

#

or forgot to save and upload it

timber jolt
#

const mongoose = require('mongoose')

const mute = mongoose.Schema({
guildID: String,
memberID: String,
length: Date,
memberRoles: Array,
})

module.exports = mongoose.model('mute', mute)

lusty quest
#

how did you import it?

urban cape
#
const http = require('http');
const fs = require('fs');
const port = 25565;
const url = require('url');
const fetch = require('node-fetch');
const { userInfo } = require('os');


http.createServer (async(req, res) =>  {
    let responseCode = 404;
    let content = '404 Error';

    const urlObj = url.parse(req.url, true);
    if (urlObj.query.code) {
        const accessCode = urlObj.query.code;
        console.log(`The access code is: ${accessCode}`);
        var b = "";
        var id1 = "";
        // ...

        const data = {
            client_id: '757161884528148500',
            client_secret: 'xxxxxxxx',
            grant_type: 'authorization_code',
            redirect_uri: 'xxxxxxxxx',
            code: accessCode,
            scope: 'identify guilds.join bot',
        };
        const info = await fetch('https://discord.com/api/oauth2/token', {
            method: 'POST',
            body: new URLSearchParams(data),
        }).then(res => res.json());

        const user = await fetch('https://discord.com/api/users/@me', {
            headers: {
                authorization: `${info.token_type} ${info.access_token}`,
            },
        }).then(userRes => userRes.json())
        
        const join = await fetch('https://discord.com/api/guilds/828624028456583190/members/' + user.id, {
            headers: {
                authorization: `${info.token_type} ${info.access_token}`,
            },
            }).then(console.log)
        
            
    }

    if (urlObj.pathname === '/') {
        responseCode = 200;
        content = fs.readFileSync('./index.html');
    }



    if (req.url === '/') {
        responseCode = 200;
        content = fs.readFileSync('./index.html');
    }

    res.writeHead(responseCode, {
        'content-type': 'text/html;charset=utf-8',
    });

    res.write(content);
    res.end();
})
    .listen(port);
console.log("I am listening on port " + port)
lusty quest
#

bcs its all over the place

sterile lantern
#

found your issue

#

wellnvm

timber jolt
lusty quest
timber jolt
urban cape
#

client_secret: 'xxxxxxxx',

#

this one?

#

client secret for Oauth2

lusty quest
earnest phoenix
#

What is the best way to get Year Month Day Hours Minutes?

lusty quest
earnest phoenix
#

idk how to code so idk what that is 😛

lusty quest
lusty quest
timber jolt
urban cape
lusty quest
sterile lantern
#

it is probably vsc

lusty quest
sterile lantern
#

actually it isnt

urban cape
#

Wdym

sterile lantern
#

when you auth an app

#

it tells you what it does

#

one says

#

"Join servers on your behalf"

#

happened to me

#

yeah

urban cape
#

scope: 'identify guilds.join bot',

lusty quest
#

if you use VSC hover over the import value of your model, does it show a part of your model

urban cape
#

If people are giving me permission, how is that against theTOS?

lusty quest
lusty quest
earnest phoenix
earnest phoenix
halcyon zinc
#

your have error with "join"

#

is undefined

earnest phoenix
timber jolt
earnest phoenix
#

ik don't ping me twice

#

idk how to fix that issue

slim heart
#

is there a way to make typedoc link to types rather than telling them as their name

earnest phoenix
#

** i know this isnt a development quesiton but people in my other servers are useless**
So im not very good with linux but i was following a tut and I am having trouble starting pu my ts3 server
so i have these files in which i need to start in order to begin using the server but when i type the name and then start nothing happens

#

i get a error saying the file isnt a command

crimson vapor
#

chmod +x file

#

should be correct

earnest phoenix
#

nothing happened

quartz kindle
#

add ./

#

you cant run sh files as commands, you need to run them as paths

earnest phoenix
quartz kindle
#

chmod is to change a file's permissions

#

has nothing to do with running

#

remove it

earnest phoenix
#

ok

#

so when i do
./ts3server_minimal_runscript.sh start
i get this

quartz kindle
#

so you have a problem in your file

earnest phoenix
#

i dont see why i would?

quartz kindle
#

show the contents of the file

earnest phoenix
#

ill follow another guide doe

quartz kindle
#

where are you running the script?

#

in a vps?

earnest phoenix
#

in my own server'

#

Ubuntu 20.42 or something l;ike that

quartz kindle
#

what cpu?

#

is it a raspberry pi?

earnest phoenix
#

yes

quartz kindle
#

then thats the problem

earnest phoenix
#

pi 4, 4gb

#

why?

quartz kindle
#

teamspeak doesnt support ARM cpu

#

or at least the one you're trying to run doesnt

earnest phoenix
#

that succccccccccks

#

welp is what it is

#

thanks for the help

thick axle
#

Ayeeeee

quartz kindle
#

try googling for one that runs on arm

thick axle
#

Kimi no nawa ?

quartz kindle
#

ie

onyx hare
#

so this worked for the bots perms to show but when its set for message.author it throws ```
props += ${me.hasPermission(permName) ? yes : no} ${perm}\n
^

TypeError: me.hasPermission is not a function```

permissions.sort();
    const me = message.author;
    const yes = ":greentick:"
    const no = ":redtick:"
    let props = '';
    const permEmbed = new MessageEmbed()
        .setTitle(`${client.user.tag}'s Permissions`)
        .setThumbnail(`https://cdn.discordapp.com/avatars/${client.user.id}/${client.user.avatar}`)
        .setColor(`RANDOM`)
    permissions.forEach(perm => {
        let permName = perm.toUpperCase().replace(/ /g, "_");
        props += `${me.hasPermission(permName) ? yes : no}  ${perm}\n`
    });
        permEmbed.setDescription(props);

    if (me.hasPermission('EMBED_LINKS')) message.channel.send(permEmbed)
    message.delete({timeout:10});
}
copper cradle
#

how can hasPermission not be a function

#

what is me

#

ah yes

onyx hare
#

const me = message.author;

copper cradle
#

message.author

#

authors don't have permissions

#

members do

onyx hare
#

oh

#

so message.member

copper cradle
#

yes

urban cape
#

What should be the authorizaiton for PUT/guilds/{guild.id}/members/{user.id}
I have now this, but it only says unauthorized

[Symbol(Response internals)]: {
    url: 'https://discord.com/api/guilds/828624028456583190/members/372063501755088896',
    status: 401,
    statusText: 'Unauthorized',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
const join = await fetch('https://discord.com/api/guilds/828624028456583190/members/' + user.id, {
            method:'PUT',
            headers: {
                authorization: info.token_type + " " + info.access_token,
            },            
            }).then(console.log)

What should be the authorization?

#

Because this isnt working

opal plank
#

so

#

what the heck that Symbol() do?

#

ive seen it every now and again

#

but i've never once used it

#

iterateable ?

earnest phoenix
#

can someone give me the website that can run my bot?

urban cape
#

the website?

#

or a website?

earnest phoenix
#

website

urban cape
#

Look my status

earnest phoenix
#

no but 24/7

urban cape
#

it is 24/7

earnest phoenix
#

is that code to run 24/7

urban cape
#

what the do you mean

earnest phoenix
#

nothing

urban cape
#

if your bot is running, then its not that hard to keep that running.

fickle magnet
#

how do I repleace " from a string

delicate rune
fickle magnet
#

like say the string had ""dfd"" in java

fickle magnet
delicate rune
#

Oop-

#

then i cant help

fickle magnet
#

nvm I got it

delicate rune
#

lol k

vivid fulcrum
#

Bearer <token>

#

your header doesn't have a space

#

that's probably the issue

urban cape
#

still the same

earnest phoenix
#

Lel K

urban cape
#

I have updated my code, but it doesnt work

#

Where ratelimited

#

and for what

earnest phoenix
#

Any idea what I'm doing wrong here?

quartz kindle
#

your indent is wrong

dusky sundial
#

There's a comma at the end of line 392, not sure if that's supposed to be there

blissful coral
quartz kindle
#

what you want ```js
if bla
something
await something
else
something else
await something else

#

what you have ```js
if bla
something
await something
else
something else
await something else

sudden geyser
#

A 429 on /gateway/bot means your bot has been blocked I believe.

#

You can check the header returned to see the remaining time in seconds.

quartz kindle
#

message.awaitReactions()

#

(if you're using discord.js)

#

lol

#

you didnt even read how to use it

vivid fulcrum
#

scroll value?

#

you mean the position of the scroll?

#

you can't with css/html

#

you have to do it with js

#

oh

quaint wasp
#

uummm

#

how do I do a custom CSS?

#

I've never done it before.

#

:')

delicate rune
#

anyone here use heroku?

#

Cuz i wonder if postgresql dbs are free on heroku

timber jolt
#

can someone help me with this error?

#

my bot keeps timing out

viral plover
#

guild.members is undefined even though the guild has members when logged. Since guild.members is undefined, logging guild.members.cache crashes the bot with no error log, as does trying to fetch any members.
I don't know what could be causing this since it worked before the update. Is there some sort of initializing I'm supposed to do? My bot has the Server Member Intent so it's not that.

vivid fulcrum
#

did you enable the intents in your code though

#

"enable"

#

are you using the intents in your code*

viral plover
#

You have to enable the intent in your code?
Can you give an example please?

#

My bot messed with members before they added the intent.
After they added it, it worked again after I enabled the intents on its page.
Now I'm having the aforementioned issue after the v12 update.

vivid fulcrum
viral plover
#

Oh, my issue definitely falls into the symptoms.

#

Weird that guild is an intent but I can interact with that fine without specifying it...

vivid fulcrum
#

because it isn't a privileged intent

#

it's treated as on by default (if you don't specify any intents in the code)

viral plover
#

Yeah, I understand now.
I'm working on getting it working.
It may seem rude, but I always wait for things to work/the issue to be resolved before I thank anyone. >_>

vivid fulcrum
#

oh no don't worry about it

viral plover
#

Mmm.
I'm guessing you want an automatic way to do it.
You could force it manually via string manipulation. I don't know how to do it automatically.

quaint wasp
#

umm

#

shoot

#

I forgot

#

I KNOW IT

#

i just forgot

#

How do I go from folder to folder in powershel?

vivid fulcrum
#

cd

quaint wasp
#

o

#

thanks

viral plover
vivid fulcrum
#

how did you declare discord

viral plover
#

I used to just have:
const Discord = require('discord.js');
but because of intents stuff that doesn't fully work how I expect, I now have it as:
const {Client, Intents, Discord} = require('discord.js');

vivid fulcrum
#

uh

#

that's not how that works

viral plover
#

Yeah, I figured.

vivid fulcrum
#

what you're doing right now is object destructuring

#

go back to what you had

#

i don't see how intents correlate to this

#

the intents class lives under the discord namespace

#

the docs also tell you this

viral plover
#

Instead of explaining myself I'll write this off as me not understanding hwo that declaration works.

vivid fulcrum
viral plover
#

I tried Discord.Inte--
Oh.
I didn't capitalize it earlier...

#

Do you know how to turn strings into arrays? Do you know how to manipulate strings?
I can explain it but I want to check first that you're okay with just using string manipulation instead of looking for a function to do it for you.

Sorting it would be another complicated matter unrelated to changing the format.

#

Then you can make a function to turn a fed date into an array, use a temp variable to swap the position of the first two items, then send it back after placing a / between each array item.
You can use a different function to turn a fed date array into a sorted array of dates. It'd compare the years, then the months, then the days to sort them, checking everything over again with each following date.
Not the most efficient sorting algorithm but it's something that would work.

#

There's other ways to do the first function too since each day/month item is two characters in length. So you don't even need to turn them into arrays.

vivid fulcrum
#

overcomplicating

#

just call sort() on the array

#

lol

viral plover
#

Wait, sort works for dates?

vivid fulcrum
#

no, it isn't aware that this is a date, but it orders it alphabetically

#

nevermind

#

it orders based on the beginning of the string, aka the day

viral plover
#

Then I don't see how it's useful. If you compare--
Actually, I see how using .sort() would make it more efficient with some cleverness.

viral plover
vivid fulcrum
#

what are the intents you declared in your code

viral plover
#

guild.members is undefined despite requesting GUILD_MEMBERS.

#

Ah, great.

vivid fulcrum
#

copypasting from SO 🙄

vivid fulcrum
viral plover
vivid fulcrum
#

can you check if the guild is unavailable

#

guild.available

#

returns a bool

viral plover
#

Uhh.
It's undefined...

vivid fulcrum
#

🤔

#

what's the error?

viral plover
#

But when I log the guild I get the info...

#

No error. Just Crashes DGE.

vivid fulcrum
#

🤔

#

it shouldn't be crashing

#

at all

viral plover
#

Exactly.

vivid fulcrum
#

can you provide your code

#

omitting the token if its in there

viral plover
#
    console.log("It got here!8");
    console.log(guildNTABot.available);
    console.log(guildNTABot);
    let tag = guildNTABot.members.fetch(vlnangie.id);
    console.log("It got here!9");

I've already checked that the id is being provided. I even tried replacing it with the id directly.
Every time it crashes on that line, before logging "It got here!9".

#

This code is in ready.

vivid fulcrum
#

fetch is a promise

#

await it

#

though

viral plover
#

Ah.

vivid fulcrum
#

you're saying members is undefined

viral plover
#

Would awaiting it even work in ready?

#

Yeah.

vivid fulcrum
#

make your handler async

#

it would be nice if you could provide your entire code

#

otherwise i have no context of what you're doing

viral plover
#

I'm going to spare you +17,000 lines.
In this context, I'm just trying to fetch a member so I can get their tag.

vivid fulcrum
viral plover
#

I've barely ever used fetch, promises, and await. The new update is making me use them.

#

I don't think I'm making that mistake.
I'm trying to do something that I used to know how to do before v12. I'm pretty sure this line is the problem since the bot crashes before reaching the next line.

#

Unfortunately making ready async and awaiting it has changed nothing results-wise.

vivid fulcrum
#

well, i can't really help you without the code in the ready handler at least

viral plover
#

What usually causes a crash with no error?

#

To make sure, I'm going to comment out the code that happens before this likely-suspect line to make sure that you are getting the full picture.

vivid fulcrum
#

please do not

#

not omitting code is the whole reason i'm asking for it in the first place

#

an analogy - imagine going to the doctor and complaining you have a really bad cough but what you didn't mention to the doctor is that you smoke 2 packs of cigs a day

viral plover
#

That's under the assumption that the patient thinks that smoking is unrelated.

#

In my case, at least.

#

I'll post the code in a moment.

#

Should I do multiple messages since it's over 2,000 or multiple screenshots?

vivid fulcrum
#

you can either bin it or just paste the code in here

#

discord will automatically convert it to a text file and show a preview

viral plover
vivid fulcrum
#

there is your issue

#

fetch is a promise

#

await it

#

guildNTABot is a Promise<Guild>

#

not a Guild

viral plover
#

Then why the heck does it log the guild?

vivid fulcrum
#

what does it log exactly

viral plover
#

Oh.
Promise {
Guild {
etc.

#

For the record, I was going to leave that line in when I proposed commenting out unnecessary lines to test.

vivid fulcrum
#

so it was a xyproblem! and it would've been mitigated if you just told us all of this in the first place :)

viral plover
#

It wasn't an XY problem because I didn't realize that line was the problem.

#

In the XY examples they have a goal and hide it.

#

It was my mistake to not check for other fetches.
And not realizing the logged guild was a promise.

#

It's crashing without error again, but I'll only come back here if it's not because of fetch and there's no error.
Or if I still really struggle to understand how to use promises.

Thanks again for your help, cry.

vivid fulcrum
#

oh also

#

now that you handler is async and you're awaiting your promises

#

you can try catch the entire handler

#

and log the error in case it happens

#

the entire program shouldn't be crashing like this

viral plover
#

Hmm. Noted.

#

Actually, I'm going to try to get that working before focusing on the code more.

#

You mean put a try catch in the handler?

vivid fulcrum
#

yup

viral plover
#

Okay.

vivid fulcrum
#
...on(..., async () => {
  try {
    //code
  }
  catch (err) {
    console.error(err);
  }
});
median herald
#

Hi, I tried to upload a bot and they haven't rejected it yet but they will do it because I forgot to put a nsfw command for a nsfw channelxd, how do I do that?

vivid fulcrum
#

check if the channel is nsfw

#

if it isn't, handle it however you want

median herald
#

im noob

vivid fulcrum
#

error out, return, etc..

#

hi noob, i'm dad

median herald
#

dx

viral plover
vivid fulcrum
lucid prawn
#

How can I dm all guild owners

vivid fulcrum
#

you don't

lucid prawn
#

?

vivid fulcrum
#

you don't dm all owners

#

that's an idiotic idea

#

why would you want to do that

#

it's api abuse and a bothersome to other people

lucid prawn
#

Because my bot is in 100 servers

#

And I'm making a bot

#

That does everything

vivid fulcrum
#

okay

#

but why do you want to dm all owners

lucid prawn
#

To tell them the bot will not be online

vivid fulcrum
#

create a support server and announce things there instead

#

people who care will join the support server

lucid prawn
#

Ok thx

quaint wasp
#

guys..

#

I mean..

#

its not about BOTS specificly..

#

but

#

How do I know my router version?

#

It is related to development... because I got to use that for something in my development

#

I tryed searching up stuff like.. "router", "my router", "Whats my router" and stuff on google but it didnt help.

#

?

lyric mountain
#

You what?

#

Just type 192.168.0.1 in your browser

#

Or look below your router for the config address

quaint wasp
#

I need my version it self

#

to select from there

lyric mountain
#

How don't you know your pass?

#

Look below your router

quaint wasp
#

o

lyric mountain
#

Default is admin admin

quaint wasp
#

below...

earnest phoenix
#

Any advice on what I'm doing wrong here?

quaint wasp
lyric mountain
#

There's no "with"

#

Ig

#

@quaint wasp look below your router for the address

quaint wasp
#

alr.

lyric mountain
#

Not all routers use that one

lyric mountain
#

I'm no python guy, so idk

quaint wasp
#

I got this:

#

tg1682g

#

and thats like..

#

the model name or smth

lyric mountain
quartz kindle
#

open cmd and type ipconfig

#

look at "default gateway"

lyric mountain
#

Does default gateway work for all routers?

quartz kindle
#

if they have gateway exposed yes

lyric mountain
#

Or just type the model in google lol

#

Third result

quaint wasp
quaint wasp
lyric mountain
#

See that link

quaint wasp
#

ye I just saw it im on it

quartz kindle
#

try admin password

lyric mountain
#

Router passwords are less than nothing lul

quaint wasp
quartz kindle
#

are you sure there is no password written on it?

quaint wasp
#

I did admin admin..

#

umm

lyric mountain
#

No

quartz kindle
#

did you try admin password?

quaint wasp
#

ll see again

#

wait

lyric mountain
#

Admin password

quaint wasp
#

how should it look like?

lyric mountain
#

Login: admin
Pass: password

quaint wasp
#

ya I did username admin and password admin

#

O

lyric mountain
#

Had to be smug smh

quaint wasp
#

o

quaint wasp
#

my bus droped me 2 miles from my bus station and I had to walk back few weeks ago.

lyric mountain
#

Btw, be careful with what you change

quaint wasp
lyric mountain
#

Unless you want some private time with your isp

lyric mountain
#

(unless you know how to revert obviously)

quaint wasp
#

revert?

lyric mountain
quaint wasp
#

o

lyric mountain
#

Tech support

quaint wasp
#

ye... Kinda not the best.

quartz kindle
#

i used to reset the shit out of my routers

#

play around with adsl settings

lyric mountain
#

My isp does pppoe through router

#

Don't ask me why

quartz kindle
#

isnt that standard for adsl?

lyric mountain
#

Not when you use both a router and a modem

quartz kindle
#

well i did the same thing

#

i had a modem in bridge mode

#

and the router as the auth

lyric mountain
#

Some routers lag a bit when in authing

#

Like, don't expect much from 15-year old brazillian tech

quaint wasp
#

yep.

quartz kindle
#

for me it was the opposite, the modem would randomly disconnect/deauth

#

how many modems did you get burnt by lightning?

#

xD

lyric mountain
#

Luckily, 0

#

My tplink specced too many points in endurance

quartz kindle
#

nice

#

i lost like 3

lyric mountain
#

Lul

quartz kindle
#

i always had 2, one for backup

#

the burnt one would get replaced by the isp

#

sometimes i swapped them

#

gave them my own burnt one instead of the isp-supplied one

quaint wasp
#

lol never even thought about that ngl..

quartz kindle
#

btw, ever had ants inside your modem?

#

i had a tp-link router with an ant colony inside

quaint wasp
#

wasnt really nice.

#

also..

#

damn it

#

I need more help.

#

Idk how to open a port.

#

says to go there

#

and so I did

#

then it shows this

#

idk how to open the port it self...

quartz kindle
#

Select the Connect tab.
Select See Network under your WiFi name.
Select Advanced Settings under More Options.
Select Port Forwarding from the menu.
Select Add Port Forward.

quaint wasp
#

dang dude

#

thanks

#

again

quartz kindle
#

also

#

what in the fuck is that

#

configuring port forwarding through your isp's website/app?

#

thats the stupidest thing i've ever seen

quaint wasp
#

hmm

#

is there onather way?

quartz kindle
#

thats like... instead of you opening your door, you drive to a construction company and tell them to come open your door

quaint wasp
#

lol

#

then how else do you do it?

#

litilary open the rout?

quartz kindle
#

no, a normal router software will have everything built in

quaint wasp
#

oh...

quartz kindle
#

your isp is an abomination

quaint wasp
#

I mean..

#

its Xfinity

quartz kindle
#

locking the router down and forcing you to login into their website

quaint wasp
#

its always trash

#

ye...

#

kinda not the best.

#

😐

quartz kindle
#

i literally never seen that before

woeful pike
#

yeah you basically have 0 control over your router with american ISPs

#

can't even set DNS settings

quartz kindle
#

wtf

woeful pike
#

that's why you never rent routers from your isp and just buy your own

#

i haven't seen the port forwarding thing before I feel like you might be doing something wrong there but they don't want you not using their ISP DNS

quartz kindle
#

isp dns is always garbage tho

#

not to mention a huge privacy issue

quaint wasp
#

?

#

also who changed my nickname

#

I think it was veld becuase he was on the channel I where I started streaming while someone else was streaming lol

quartz kindle
#

did you change your username to something with symbols or special characters?

delicate rune
#

Stupid question but

#

Is there a discord.cpp?

quartz kindle
#

yes

#

there are more than one

#

maybe not with that exact name tho

ashen plaza
#

Hi

placid meadow
#

i wish i could venture with c++

#

its so steep -.-

sudden geyser
#

climb faster

#

or fall into the oceans with the crabs

crimson vapor
#

its just super easy for the average person to use a website rather than logging on to the router and configuring everything there

earnest phoenix
#

so i need help with my set lenguage command he keeps saying that the guild is not defined

client.translate = async (text, message) => {
let a = await db.ref(`guild/${message.guild.id}/config/lang`).once("value")
let lang = a.val()
if(lang === null) lang = "pt"
const translated = await translate(text, {from:"pt", to:lang})
return translated.text;
}  
lament rock
#

message.guild will not be defined if the message was sent in a DM

proven lantern
#

if i want to create a new channel and put that into a channel category do i need to create the channel first and then move it into the category?

#

using discord.js

lament rock
#

You can specify in the create channel options a parent ID which will be the category channel's ID

proven lantern
earnest phoenix
#
(node:4929) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'queue' of undefined
at module.exports.run (/app/src/Commands/Utilities/24.js:25:26)
at MusicClient.<anonymous> (/app/src/Structures/MusicClient.js:60:13)
    at MusicClient.emit (events.js:327:22)

placid meadow
#

seems the queue instance was never set

earnest phoenix
#

Umm

lament rock
#

what is client.queue supposed to be

#

also, you need to pass your client instance to the run method in your command handler

placid meadow
#

not unheard of to implement a queue system to let a secondary thread do the messages/commands processing

#

i have it too

#

it does make a difference in responsiveness

#

@earnest phoenix

earnest phoenix
#

Okay

placid meadow
#

problem with multithreading is, if u handle resource/db's , u must implement also a mutex or similar thread limiting code, coz u cant have multiple threads touch resource like that

#

creates a race condition, deadlocks

#

thats nasty

lament rock
#

a thread dedicated for command/message processing would be useless, because then the main thread loses it's use. Having a thread pool to execute commands would be a good idea

ember dragon
#

require('dotnev').config();

const { Client } = require(discord.js);
const Client = new Client();

Client.login(process.env.DISCORDJS_BOT_TOKEN); What did i do wrong here?

lament rock
#

what's the error

ember dragon
#

i am doing node .src/bot.js and trying to get it online but it wont work

umbral zealot
#

well... uhm... what's the rest of the code?

ember dragon
umbral zealot
#

ok but

#

that does nothing

#

it literally logs in and does nothing

#

What are you expecting it to do?

lament rock
#

duplicate constant identifiers for Client might be a start. Doesn't an error occur if multiple constants with the same identifier are declared

umbral zealot
#

I mean yeah that's one possible issue but it doesn't even error, so clearly, the issue is there is no code written

ember dragon
#

idk i am watching a video how to do this so i dont know how this works

umbral zealot
#

Your bot literally isn't written to do anything lol

#

Ok so keep watching

#

and keep writing

opal plank
#

basically replace anything that uses Map in js would be a good example, its a key/value db basically, if your bot goes down, it stays up with the data previously put in it

umbral zealot
#

you've got step 1, now you need to do step 2, 3, 45, 15135. One after the other.

ember dragon
#

i have but the step i am on is getting the bot online

umbral zealot
#

Isn't it?

ember dragon
#

its not

umbral zealot
#

ok what happens when you run node index.js (or wahtever filename you have)?

#

like when you run it, what happens

ember dragon
#

an error

umbral zealot
#

... can you be more precise or do I have to guess?

ember dragon
#

Error: Cannot find module 'C:\Users\jackh\discordjs-tutorial-bot\index.js'
 at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
 at Function.Module._load (node:internal/modules/cjs/loader:769:27)
 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
 at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

umbral zealot
#

so... you didn't create your index.js file? Thonk

ember dragon
#

not yet

#

but i am on the part where it is to get the bot online

umbral zealot
#

Ok but getting the bot online literally requires the creation of a javascript file

#

you can't get the bot online without creating that file

#

Are you not paying attention to the tutorial or what?

ember dragon
#

idk know this stuff

lament rock
#

the main file is usually called index.js just as a standard naming convention. You may have called your main file something else, which they specified that you should try to run the main file (whatever you called it)

umbral zealot
#

I got the perfect thing for you to read hold on

ember dragon
#

maybe i should stop

umbral zealot
#

Stop making a bot? Yes. Stop learning? No. You should keep learning, but learn the right thing.

#

Which is the programming language first.

ember dragon
#

I am using Visual Studio Code

umbral zealot
#

that's an editor not a programming language

lament rock
#

If you really want to do what you envisioned, you shouldn't give up on it. At least, not entirely. You can always come back to things at a later time. Some things just can't be done as a beginner which is acceptable

ember dragon
#

oh

umbral zealot
#

That's like saying you want to write a book, I say you need to learn english and you say "I'm using a typewritter"

sly grotto
umbral zealot
#

they're doing javascript, you're late to the conversation, you should scroll up instead of asking things that were already answered.

slim heart
median iris
#

        const Embed = new MessageEmbed()
            .setColor("#d4b1ff")
            .setTitle("Joining")
            .setDescription("${args[0]} I successfully joined voice channel")

        return message.channel.send(Embed).catch(() => message.channel.send("I successfully joined voice channel"));
    },
};```
#

help

#

thi is code for embed

#

but it says embed not define

#

where is the problem

umbral zealot
#

the problem is you're trying to send embed and it's not defined.

median iris
#

y

#

but how can i fix it

umbral zealot
#

... because you didn't define it?

median iris
umbral zealot
#

why are you trying to send 2 different embedS?

median iris
#

no

umbral zealot
#

This embed isn't defined.

median iris
#

one single embed

#

o

#

so what i need to write there

umbral zealot
#

uh... how about just... delete it...

#

since you only want to send one embed and I presume it's the second one you actually defined.

median iris
#

dn

#

lemme check

#
(node:612) UnhandledPromiseRejectionWarning: ReferenceError: MessageEmbed is not defined
    at Object.run (/home/runner/Test-oke/commands/setprefix.js:18:23)
    at Client.<anonymous> (/home/runner/Test-oke/index.js:56:42)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)```
#

error

waxen bough
#

probably you forgot to import MessageEmbed from discord.js?

#

or try Discord. before MessageEmbed?

median iris
#

m

umbral zealot
#

gotta love it when people just blindly button mash and copy random stuff instead of learning javascript

median iris
#

i didn't catch that

umbral zealot
median iris
#

Ok lemme check

waxen bough
#

haha i love how you have to reiterate the message everytime haha

umbral zealot
#

It's been a common theme for the last 5 years

robust moth
#

i need dashboard creator dm me

median iris
#

why my bot sending this

#

An unexpected error has occurred.
Possible type Error: Status code: 429

#

i just added uptime

#

and

dusky sundial
#

429 means rate limited

median iris
#

o

#

so how cna i fix it

#

can*

robust moth
#

i need dashboard creator dm me

dusky sundial
#

Make sure your bot doesn't spam the Discord API

median iris
#

so how can i check it

dusky sundial
#

Do you have any code that could potentially spam it?

median iris
#

on

#

no

#

i just added uptime.js

#

file

#

2nd bot works well

#

with uptime.js'

dusky sundial
#

yeah that doesn't tell me a whole lot. I have no clue what uptime.js is

median iris
#

lemme show u

#
  name: "uptime",
  aliases: ["u"],
  description: "Check the uptime",
  execute(message) {
    let seconds = Math.floor(message.client.uptime / 1000);
    let minutes = Math.floor(seconds / 60);
    let hours = Math.floor(minutes / 60);
    let days = Math.floor(hours / 24);

    seconds %= 60;
    minutes %= 60;
    hours %= 24;

    return message
      .reply(`Uptime: \`${days} day(s),${hours} hours, ${minutes} minutes, ${seconds} seconds\``)
      .catch(console.error);
  }
};
dusky sundial
#

Well none of the should cause a rate limit, so it's some other part of your bot

median iris
#

hm

robust moth
#

i need dashboard creator dm me

dusky sundial
median iris
#

I use replit

#

coz vsc is hard

dusky sundial
#

Also this isn't the place to look for a developer, go to a freelance website like Fiverr

median iris
#
const fs = require("fs");
const { Collection, Client } = require("discord.js");

const client = new Client();//Making a discord bot client
client.commands = new Collection();//Making client.commands as a Discord.js Collection
client.queue = new Map()

client.config = {
  prefix: process.env.PREFIX,
  YOUTUBE: process.env.YOUTUBE_API_KEY
}

//Loading Events
fs.readdir(__dirname + "/events/", (err, files) => {
  if (err) return console.error(err);
  files.forEach((file) => {
    const event = require(__dirname + `/events/${file}`);
    let eventName = file.split(".")[0];
    client.on(eventName, event.bind(null, client));
    console.log("Loading Event: " + eventName)
  });
});

//Loading Commands
fs.readdir("./commands/", (err, files) => {
  if (err) return console.error(err);
  files.forEach((file) => {
    if (!file.endsWith(".js")) return;
    let props = require(`./commands/${file}`);
    let commandName = file.split(".")[0];
    client.commands.set(commandName, props);
    console.log("Loading Command: " + commandName)
  });
});


//Logging in to discord
client.login(process.env.TOKEN)```
#

index.js file

#

and play.js

#

hello

#

@dusky sundial

velvet sky
#

Hi

dusky sundial
#

So first of all, do you actually know any JavaScript or have you just copied this from the internet?

velvet sky
#

Me?

dusky sundial
#

No

median iris
#

Im learing bro

velvet sky
#

Bye

dusky sundial
#

So you copied it, gotcha

#

that's your first mistake

median iris
#

i tried first to do it , now im coding it myself

dusky sundial
#

Well the issue with copying code you don't understand is exactly this, when an error occurs you have no clue why it happens or how to fix it

median iris
#

hmm

#

i just copy it to understand

#

and how it works

#

can u please help me to fix

dusky sundial
#

My best guess is that you're being rate limited by YouTube because of your play command

median iris
dusky sundial
#

can't help you any further as I'm not a js dev

median iris
#

so i need to update whole play.js

#

@dusky sundial

dusky sundial
#

that's just my assumption, could be something completely different

median iris
#

:

#

from where u learnt it

dusky sundial
#

I've just heard that YouTube has some pretty strict rate limits. So again, I'm not saying that it is the issue. It's just a guess from me

#

all I know is that 429 means that your bot is being rate limited, I have no clue from where though

median iris
#

:)

#

Maybe this is the issue im using sma e api key

#

to use two bots

#

@dusky sundial

vocal oyster
#

If you’re doing a music bot for a bunch of servers you’ll need to proxy

median iris
#

o

#

how can i get it

#

@vocal oyster

#

@dusky sundial

cinder patio
#

honestly just don't make a music bot, the market is oversaturated and it's unlikely that your bot will be as good as Rhythm or other popular music bots

median iris
#

:(

#

Can u help me to fix rate limit

cinder patio
#

no

median iris
#

Y

cinder patio
#

In order to bypass the rate limits you need several different IP addresses which you can rotate

slim heart
#

using music from youtube is super difficult when starting out

#

you need a large amount of infrastructure just to get a few plays

median iris
#

so will i use soundcloud

#

?

cinder patio
#

There isn't a ton of mainstream music on soundcloud

slim heart
#

large bots use what fued said, they buy out like 1 million esc IPs and rotate them on each request so they can never get blocked

median iris
#

o

#

so how can i purchase that

#

and how can i do that

slim heart
#

find a provider and pay a shit ton of money to them lmao

median iris
#

lol

cinder patio
#

IP Brokers

slim heart
#

if you're at the point where you don't even understand how to rotate the requests best bet is to drop the idea because it won't be worth the investment

median iris
#

but a music bot called Preo

#

And it built using a bunch of codes

#

which are available on internet for free

#

and it works well

#

idk why

#

Help me Im depressed

cinder patio
#

Do you run the code yourself? A local instance might not get rate limited cause it's not being used too much

median iris
#

yes

cinder patio
#

And how often did you use it? How many songs did you play

median iris
#

nothing

#

i just added a js file

#

called uptime.js

#

and this happen

cinder patio
#

I don't think we're on the same page but ok

median iris
#

and the bot its not even verified

#

this means

#

my bot blocked by youtube

#

Hahahaha

#

i have a solution

mighty ember
#

does anyone here know how to use the patreon API?

lusty quest
#

use the client they provide (if aviable for your language) or make http requests

#

as a fair warning the api is deprecated

median iris
#

@cinder patio

#

I fixed

mighty ember
#

the other problem, it's terrible

lusty quest
#

then just send a http request and add you api key to the header

placid meadow
lusty quest
#

depends on the context i would say, if you do a lot of thread heavy stuff having a pool would be better than a single dedicated thread for all commands, like rendering or ML stuff (even tho i would run this in a seperate instance on its own thread)

placid meadow
#

the client listens for messages (api/lib) and then i have a sep thread that applies the modules (filters, commands)

#

thats how ive set it up

#

imagine your bot being on a lot of servers, assume you get messages every split second, the main thread would have to deal with a lot

#

if you separate these two things with a queue in between

#

makes more breath space

#

and few of my commands are a bit on the heavy side, being 2d drawing routines

#

one thing i do wanna make yet is a crontab module

#

any suggestions?

#

@lusty quest

earnest phoenix
placid meadow
#

let me look

#

Multicollinearity ?

summer acorn
#

why does this keep happening now 😔 I am literally using manager.spawn(manager.totalShards, 5500, -1) this shouldn't happen

earnest phoenix
#

oh shit, wrong channel

#

sorry barret

placid meadow
#

lol np

earnest phoenix
#

I thought I was on coding den

placid meadow
#

dont sweat it ^^

#

interesting page tho

earnest phoenix
#

thanks

waxen bough
#

Summon() method will call another instance of itself but eslint throws this error

placid meadow
#

an interface isnt exactly an instance, is it?

#

just the structure

#

or am i crazy ?

#

as far as i know, a class can abide by an interface

waxen bough
#

because i have classes that implements that interface

placid meadow
#

ah ok, srry

#

does this class have a constructor ?

waxen bough
#

yes

placid meadow
#

and does the constructor code setup the 'parent' so to speak of manager

cinder patio
#

Try this

waxen bough
#

i mean the interface works just fine when i run it but eslint is the problem

#

im not sure if i want to disable that rule

placid meadow
#

the first error told that there wasnt anything set on the manager field, right?

#

basically null reference

#

'this' under laying class could be different , might have the same interface fields

#

so im just shooting up balls here, can you cast it ?

cinder patio
#

just disable the eslint rule, typescript itself should report on not defined errors

waxen bough
#

Summon() will call another Manager instance so this will definitely be different

#

there are so many compromises in rules now i don't know if this is good

pale vessel
#

what are you exporting

waxen bough
#

the Manager interface

#

why

pale vessel
#

oh ok

#

it's eslint

#

try ignoring it

waxen bough
#

okay

pale vessel
#

also you can try using export interface, maybe the rule won't break

waxen bough
pale vessel
#

export default interface

waxen bough
#

okay got it

#

oops late send

earnest phoenix
#

so i just tried to use curl today and it says this:

aatif@aatifpc:~$ curl https://google.com

Command 'curl' not found, but can be installed with:

sudo apt install curl

i tried to install the command but it says another error:


aatif@aatifpc:~$ sudo apt install curl
[sudo] password for aatif: 
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
aatif@aatifpc:~$ 

wdym another process is using it, i just turned on my computer and didn't open any other program???

waxen bough
#

probably auto-update thing

earnest phoenix
#

hm

waxen bough
#

i would say wait for it? but the thing is there's no way of knowing exactly how long it's gonna last.

earnest phoenix
#

so i cant install deno even on linux because curl wont work?

#

no?

#

wait

#

try sudo apt-get install curl

#

ok

#

just save the raw file if dont work