#development

1 messages · Page 1022 of 1

delicate shore
#

this is not working

#

i wanna get avtar

pure lion
#

err?

delicate shore
#

as thumnail

#

it says

#
embed.thumbnail.url: Not a well formed URL.
    at RequestHandler.execute (/rbd/pnpm-volume/38b33121-f779-43cc-a95d-c99a7cf7a9d4/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:27518) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:27518) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

<user>.displayAvatarURL()
@earnest phoenix ok

still merlin
#

Can I have some help? It wants a semi-colon at the fullstop but when I put one there it gives me more error's

delicate shore
#

@earnest phoenix nope

#

not working

#

  if(command === "whois"){
     let member = msg.mentions.members.first() || msg.member,
  user = member.user;
    const joinDiscord = moment(user.createdAt).format('llll');
    const joinServer = moment(user.joinedAt).format('llll');
    let whois = new Discord.MessageEmbed()
        .setAuthor(user.username + '#' + user.discriminator, user.displayAvatarURL)
        .setDescription(`${user}`)
        .setColor(`RANDOM`)
        .setThumbnail(`${user.displayAvatarURL()}`)
        .addField('Joined at:', `${moment.utc(user.joinedAt).format('dddd, MMMM Do YYYY, HH:mm:ss')}`, true)
        .addField('Status:', user.presence.status, true)
         .addField('Roles:', member.roles.cache.map(r => `${r}`).join(' | '), true)
        .setFooter(`ID: ${user.id}`)
        .setTimestamp();

    msg.channel.send(whois);
    console.log();
    
  }
opal plank
#

@still merlin ?why not a string

delicate shore
#

this code is giving no logs

#

but msg not being sent

pure lion
#

i was gonna star that

#

:plog:

delicate shore
#

so what to do?

restive pebble
#

are u doing try catch? @delicate shore

delicate shore
#

no

restive pebble
#

then its strange

opal plank
#

use setFIELDS

still merlin
#

I tried a string just now and more errors

restive pebble
#

no error = strange case

opal plank
#

@still merlin what exactly is that for? attachment?

still merlin
#

I want to set the backround to a image

opal plank
#

i can see that

#

but thats not what i asked

#

is that form a file or what?

#

you trying to send an attachment on the body?

delicate shore
#

not working

opal plank
#

@still merlin usually you'd be pointing at an url when setting background img(a string)

plucky harness
#

do u guys use ngrok?

#
-bash: ./ngrok: Permission denied`` why am i gettin this ?```
restive pebble
#

@delicate shore any error

plucky harness
delicate shore
#

@delicate shore any error
@restive pebble nooe

restive pebble
#

strange

delicate shore
#

@restive pebble nvm

restive pebble
#

try{
//code}catch(e){console.log(e)}
[@delicate shore ]

delicate shore
#

i forgot to refresh

restive pebble
#

lol

#

i told

delicate shore
restive pebble
delicate shore
#

how to fill this empty space

#

like

#

i want the user pic to come there

restive pebble
#

no.way lol

delicate shore
#

oh

opal plank
#

those roles gave me cancer

delicate shore
#

lol

opal plank
#

who puts their roles as ----------whateverthefuck--------

delicate shore
opal plank
#

thanks, i hate it

livid rivet
#

inline reee pepePuke

delicate shore
#
 if (command === "news") {
    try {
      const response = await fetch(
        `https://newsapi.org/v2/top-headlines?sources=reuters&pageSize=5&apiKey=87a0130e397a4e45a4fd707eb93c5922`
      );
      const json = await response.json();
      const articleArr = json.articles;
      let processArticle = article => {
        const embed = new Discord.MessageEmbed()
          .setColor("#FF4F00")
          .setTitle(article.title)
          .setURL(article.url)
          .setAuthor(article.author)
          .setDescription(article.description)
          .setThumbnail(article.urlToImage)
          .setTimestamp(article.publishedAt)
          .setFooter("powered by NewsAPI.org");
        return embed;
      };
      async function processArray(array) {
        for (const article of array) {
          const msg = await processArticle(article);
          msg.channel.send(msg);
        }
      }
      await processArray(articleArr);
    } catch (e) {
      msg.reply("Something failed along the way");
      return console.error(e);
    }
  }```
#

this is not working

#

it says cannot read property send

#

it was working few days back

#

idk what happens

cinder patio
#

processArticle returns an embed, a MessageEmbed object - a class that represents an embed, not a message

delicate shore
#

oh

#

so?

#

wait

#

no

cinder patio
#

yes

delicate shore
#

how

#

what should i do?

#

like

#

what should i return?

cinder patio
#

Is your message object called msg?

delicate shore
#

it's called embed

cinder patio
#

No, embed is a MessageEmbed, it just represents an embed, it's not a message containing the embed

delicate shore
#

const embed = new Discord.MessageEmbed()

#

^^^

spare mirage
#

do u use bot.on('message', message =>{

cinder patio
#

Yes, that's an embed

delicate shore
#

ok

cinder patio
#

not a message

delicate shore
#

const msg = await processArticle(article);

cinder patio
#

that returns the embed

#

not a message

delicate shore
#

i am confusion

#

like

#

what do i have to return

cinder patio
#

Nothing - that function is perfectly fine, after it you are doing msg.channel.send(msg) which actually means MessageEmbed.channel.send(theEmbed)

#

MessageEmbeds don't have a channel property

#

because they're just embeds

delicate shore
#

ohhhhh

#

will it work now?

#

and i will do msg69

#

down also

cinder patio
#

now you are sending the message object, replace the msg argument with msg69

#

And in the catch statement it should be just msg

delicate shore
#

ok

#

it worked

#

thnx

#

and you are very good at explanation

opal plank
#
 let processArticle = article => {}```
whats this for?
cinder patio
#

It's a way to declare an anonymous function and use it

opal plank
#

hmmm interesting

tulip ledge
#

@spare mirage Didn't like 5 people tell you yesterday to learn basic js before asking questions?

spare mirage
#

@tulip ledge stfu

tulip ledge
spare mirage
#

lol

#

They can tell me to

#

I can do it

#

and I can not do it

tulip ledge
#

And people won't help you if you don't do as they ask

spare mirage
#

Im learning js and take breaks to work on a discord bot

tulip ledge
#

These people are giving you parts of their free time and you are not even willing to do what they ask

visual sandal
#

I am having a small issue
if I console.log this module.exports.code.usage[0] i get

%P%fix [USER_ID]

but calling a function and replacing certain characters gives me this error

(node:16148) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of undefined

and logging the input the function gets shows this and i don't know where the undefined's source is

%P%fix [USER_ID]
undefined

Here is the code

    // module.exports.code.usage[0] --> Works fine, shows string
    let new = clean(module.exports.code.usage[0])

    function clean(input) {
    // input -> Shows string and undefined
        input.replace(/%P%/g, client.prefix);
        return input;
    }

    module.exports.code = {
        title: "fix",
        usage: ["%P%fix [USER_ID]"],
    }
tulip ledge
#

Kurasad you can't call the function if it's not in a module.exports

spare mirage
#

@tulip ledge !?!? I still do it though

tulip ledge
#

But you are asking basic questions

#

🤔

spare mirage
#

yes

#

Imagine learning javascript in 3 hours

#

lmfaooo

tulip ledge
#

In 3 hours people can prob do better then you ngl

visual sandal
tulip ledge
#

Ok

#

What unput are you giving?

spare mirage
#
7.
      a. Don’t spoon-feed or attack beginners.
           Everyone starts somewhere and asking questions is smart. Do not attack people for not knowing how to code. Point them to great learning sources and help them with problems.
           However, you shouldn’t just give them finished code because then they only learn to copy more.
      b. If you are a beginner, have a will to learn and do not expect to be spoon-fed.```
visual sandal
#

What unput are you giving?
a string

tulip ledge
#

Yes but over a span of what I've seen at least a week we have told you to first learn the basics before asking questions

spare mirage
#

Dont attack beginners. I feel attcked

tulip ledge
#

And you have clearly not learned the basics

#

Alright go ahead and report me then

spare mirage
#

Im learning js and take breaks to work on a discord bot

#

Im just not the smartest alive. I guess

opal plank
#

while not against the rules, most people will avoid anwsering you a question about a language that you dont even know about. I've said a bunch of times before, a bot is an intermediate level difficulty project, you cant just hop into it without knowing 2 things about it.

tulip ledge
#

^^^

opal plank
#

my usual example is:
you're trying to write an essay in russian without knowing russian

tulip ledge
#

@visual sandal What string exactly

visual sandal
#
usage: ["%P%fix [USER_ID]"],

Index 0

plucky harness
#

-bash: ./ngrok: Permission denied on ubuntu? why

tulip ledge
#

Oh I see

spare mirage
#

@opal plank Yes, ur right...
Still I find it weird when I say: "Im learning JS but it takes time" some people go mad on me

#

¯_(ツ)_/¯

opal plank
#

in those instances i keep my sarcastic comments to myself to not lash onto them, but i do tell them to learn the language before asking those questions

tulip ledge
#

Justii you keep asking the same questions and we're trying to help you but you clearly ask the same basic questions every single time

spare mirage
#

the same basic questions

tulip ledge
#

@visual sandal Try changing let new to let <something> since new is a keyword and thta might be a problem

visual sandal
#

i just put new as an example, i know that is definitely wrong lol

opal plank
#

the main problem when people come are:

  • You dont know anything about the language, not even the most basics
  • You refuse to do research instead of asking here first, this isnt Bing/Google
  • You dont read the Docs which gives ample examples of what you're trying to do
  • They ask for spoonfed code
#

the approach is. Read doc about it. Try it. If it doesnt work, try a couple more times. Still stuck? ask

spare mirage
#
  • You dont know anything about the language, not even the most basics
    I totally agree... I made this mistake :/
tulip ledge
#

I see you're using regex can you try it with a string just to see if it might be your regex that is messed up?

#

@visual sandal

#

If so we need to change your regex

visual sandal
#

well, i log it even before the regex and there is an undefined

tulip ledge
#

So input is undefined?

#

Or what do you mean?

#

Can you console.log(module.exports.code.usage[0])

visual sandal
#

I and sending it this %P%fix [USER_ID]
but it is receiving

%P%fix [USER_ID]
undefined
tulip ledge
#

Oh sorry I saw u did it

#

Already

#

Ok

#

Mmmh

pale vessel
#

did you define client.prefix?

visual sandal
#

yea, but the issue isn't even the regex

tulip ledge
#

Can you try to log client.prefix?

#

And see what that gives?

visual sandal
#

works fine

tulip ledge
#

Alright

#

I'm gonna try to eval some stuff

#

Give me a sec

visual sandal
#

ok

tulip ledge
#

But this seems to work

#

Wait a sec

visual sandal
#

kk

tulip ledge
#

You are replacing the string but arent overwriting it

#

Meaning input stays as input

#

As you can see here

pale vessel
#

return input.replace(); would've been fine

tulip ledge
#

Yes also

pale vessel
#

replace doesn't modify the original string

shadow flame
#

Anyone help me ??

tulip ledge
#

Problem?

pale vessel
#

unlike shift, pop, and some other methods (for arrays for example)

shadow flame
#

I’m screenshare on my channel than someone join my screen share than my discord restart

tulip ledge
#

Is there a method that directly modifies a string? 🤔

#

Idk dude doesn't seem like a development issue

#

Could be anything actually

shadow flame
#

No one can join my screen share 😕

#

Whan anyone tap to join my discord reopen automatically restart

summer torrent
#

ask Discord

visual sandal
#

But the thing is the replace isn't the issue it's the input the function is getting cause using my backup function gives me the same error

    clean(input) {
        let original = [`{PREFIX}`, `{BOT}`];
        let replace = [process.env.PREFIX, client.user.username];
        for (let i = 0; i < original.length; i++) {
            while (input.includes(original[i])) {
                let loc = input.indexOf(original[i]);
                input = `${input.substring(0, loc)}${replace[i]}${input.substring(loc + original[i].length)}`;
            }
        }
        return input;
    },
summer torrent
tulip ledge
#

Could be an issue with your drivers

#

Pretty sure it is actualy

shadow flame
#

@summer torrent where

tulip ledge
#

Maybe update your drivers

#

And see if that helps

summer torrent
#

click the link I sent

visual sandal
#

lemme try

shadow flame
#

No find

summer torrent
shadow flame
#

@tulip ledge 🤔which one

tulip ledge
#

Depends on your graphics card

shadow flame
#

Graphics card driver update already

tulip ledge
#

@visual sandal What is your input

#

Once again

#

Since if you are sure it's your input causing it it means your input is undefined

fresh hatch
#
if(!message.member.hasPermission("BAN_MEMBERS")) {
            message.channel.send("You don't have permissions to use this command! :person_facepalming:")
        } else {
            let memberId = message.content.substring(message.content.indexOf(4))
            let member = message.guild.members.cache.get(memberId);
            if(member) {
                member.ban()
            } else {
                message.reply("User not found! :person_facepalming:")
            }
        } 

Can somebody help me why do i always get the message.reply("User not found! :person_facepalming:") even if i enter a correct userID ?

visual sandal
#

yea, consoling the input inside of the function shows the string appended with an undefined, and idk what the source of the undefined is

tulip ledge
#

Try to log member

spare mirage
#

Can I make my bot add emojis to a server?

tulip ledge
#

So when you are calling the function

#

@spare mirage Take a look at https://discord.js.org

summer torrent
#

@spare mirage yes

fresh hatch
tulip ledge
#

@visual sandal Where are you calling the function?

fresh hatch
#

member is undefined

spare mirage
#

ahh I see thanks

celest schooner
tulip ledge
#

Why don't you just look for the first mention and then get the id based of the member object?

visual sandal
#

    if (!args.join(` `)) { return message.channel.send(client.src.clean(module.exports.code.usage[0])); };
tulip ledge
#

And module.exports.code.usage[0] logs %P%fix [USERID]?

visual sandal
#

yep

tulip ledge
#

Even in the same file where you're calling the function

fresh hatch
#
message.mentions.members.first();
#

Is it corrrect @tulip ledge ?

#

*correct

tulip ledge
#

should be

fresh hatch
#

works

celest schooner
#

What is he wants to ban by ID

visual sandal
#

calling it in the same file still adds an undefined...

tulip ledge
#

You can then get the argument wich is the id

#

And then look if the member exists based on the id

fresh hatch
#

yea

#

brb

celest schooner
#

you can guildManager.ban

tulip ledge
#

So @visual sandal module.exports.code.usage[0] is undefined

#

Is what you're saying

#

Right?

#

As you said that the input gives undefined

visual sandal
#

No, it is defined and logs as a string, but when in the function it adds undefined

#

that's what i get when i log inside the function

tulip ledge
#

Brb

#

Give me 2 minutes

#

Ill be back in a sec

visual sandal
#

ok

surreal notch
#

What are shards what's purpose of them and how to use them?

tulip ledge
#

@surreal notch Shards is basically making multiple instances of your bot on the same CPU making your bot faster and use less memory although they might use more CPU

weary anchor
#

As an application grows large, developers may find it necessary to split their process up to run parallel to one another in order to maximize efficiency. In a much larger scale of things, the developer might notice their process slow down, amongst other problems.

surreal notch
#

Okk

#

Means I don't need it now

#

Lol

weary anchor
#

xD

tulip ledge
#

You only need to worry when you are around 1800 guilds and start sharding around 2000 guilds

surreal notch
#

Okk

fresh hatch
surreal notch
tulip ledge
#

It works

#

client.prefix is just undefined for me

visual sandal
#

hmm ok

tulip ledge
#

Your problem is the input

#

module.exports.code.usage[0] is probably not the way you can access it

#

Are you saving them to your client object?

fresh hatch
#

I remember like 6 months ago i didn't have a command handler and i thought node . would run all my files without a command handler

tulip ledge
#

Cuz you can try to filter the client.<what u saved it to> to find the one with the name "fix" and then access usage[0] from there

#

Or try console.log(module.exports.code) and see what it logs

visual sandal
#

module.exports.code.usage[0] is probably not the way you can access it
@tulip ledge sending it a normal string like "hi" has the same issue

tulip ledge
visual sandal
tulip ledge
#

I see now

visual sandal
#

I currently don't have my eval command running so this problem is taking me forever to even find the source

tulip ledge
#

maybe its due to your module.exports is being defined after you are trying to clean it

visual sandal
#

got it, i was calling a function before calling the clean function and somehow nested both of em

odd radish
#

how can i make the bot icon on the top.gg page round with css

tulip ledge
#

img { border-radius: 50%; }

#

img being the thing you want to access

#

I don't know what it is

odd radish
#

ok thankyou

tulip ledge
#

But you can use inspect element to find it

fresh hatch
#
client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}`)
    client.user.setActivity("?help | In " + client.guilds.cache.size + " servers"); 
})

// Command Handler
(async function registerCommand(dir = 'commands') {
    // Read the directory/file
    let files = await fs.readdir(path.join(__dirname, dir));
    console.log(files)
});
(async function registerCommand(dir = 'commands') {
^

TypeError: client.on(...) is not a function

Someone help me? I'm trying to make a command handler

tulip ledge
#

(async function registerCommand(dir = 'commands') waitWhat

#

The first ( has to go

#

First of all

weary anchor
#
(async function registerCommand(dir = 'commands') {
    // Read the directory/file
    let files = await fs.readdir(path.join(__dirname, dir));
    console.log(files)
});

should be like

async function registerCommand(dir = 'commands') {
    // Read the directory/file
    let files = await fs.readdir(path.join(__dirname, dir));
    console.log(files)
};
coral stirrup
#

the ) after 'commands' has to go to.

weary anchor
#

why are you wrapping them in ()?

tulip ledge
#

No

#

It doesnt

tulip ledge
#

@coral stirrup

#

Its a function

opal plank
#

@fresh hatch no

tulip ledge
#

And () are wrappers for parameters

opal plank
coral stirrup
#

ah my bad, i thought for a second it was a callback.

opal plank
#

do it the proper way

#

dont watch youtube videos

fresh hatch
opal plank
tulip ledge
#

Well your tutorial maker clearly doesn't know how to code

fresh hatch
#

ok @opal plank

coral stirrup
#

you have to execute that function, my dear.

tulip ledge
#

Documentations are WAY BETTER then tutorials

sudden geyser
#

Documentation and tutorials can both be helpful.

odd radish
#

Sry but i have another questions it is possible to change this arrow up icon or to change the color

weary anchor
#

Tutorials are often outdated. Up to date documentation are the bet.

tulip ledge
#

Tutorials are showing how the tutorial maker does it, documentions shows how to use stuff allowing you to adapt it to your own style of coding wich is way better

weary anchor
#

^^

opal plank
#

tutorial / stackoverflow = copy + paste
docs = actually learning

sudden geyser
#

If I were to read the documentation and did not understand it (such as a language or all of the docs), I could do a bit more searching and see if an article or someone else is able to explain the last juice I need to understand it.

fresh hatch
tulip ledge
#

Ok? Works fine doesn't it?

#

No errors

pale vessel
#

don't put const

tulip ledge
#

Oh I see syntax error

opal plank
#

client.commands ....

#

not const

past nova
#

is there any way of using reactions across shards?

tulip ledge
#

Since client is an already defined object you can't make a new object client.commands

opal plank
#

fuck my life, i gotta rewrite 4 bots now -.-

pale vessel
#

for what

opal plank
#

for my bot extensions

fresh hatch
opal plank
#

ok....?

#

what are you trying to say with that screenshot?

fresh hatch
#

that ive done what the documentation says and there's a syntax error

opal plank
#

no you havent

tulip ledge
#

You have not

#

You did const client.commands

opal plank
#

you did const client.commands

tulip ledge
#

And it clearly sais client.commands

opal plank
#

client.commands, without const, as we said

#

don't put const

client.commands ....
not const

tulip ledge
#

Dont just blindly copy paste

#

Also read what it sais

opal plank
#

clearly states client.commands

fresh hatch
#

it only logs kick

#

not ban

#

brb

#

back

tulip ledge
#

Since you did it wrong

#

Where is your commands file?

#

If you want to read the files inside folders inside your command folder you're gonna need a more advanced command handler

opal plank
#

commando should work for that if thats your go-to

fresh hatch
opal plank
#

so, whats the error?

solemn latch
#

You have been given a few fixes.
Should do them rather than just pasting your code repeatedly

cobalt spruce
fresh hatch
#

i doesn't log the other commands

#

only kick.js

pale vessel
#

createRole? that's old

cobalt spruce
#

@pale vessel wats new

#

am old

solemn latch
#

You where told why @fresh hatch

opal plank
#

thats v11?

cobalt spruce
#

@opal plank bro fix mine pls its v12

pale vessel
#

we don't spoonfeed mate

cobalt spruce
#

am using old commands from my old bot

#

@pale vessel PLZ

pale vessel
cobalt spruce
#

@pale vessel i did and i didnt understand a shit

pale vessel
#

read docs

cobalt spruce
#

PLZ

#

BRUH

pale vessel
#

no

cobalt spruce
#

ama cry

#

pepe

#

plz

solemn latch
#

Is reading docs really that hard?

cobalt spruce
#

no

#

i didnt understand

#

@solemn latch plz

#

i need help

pale vessel
#

can you not ping everyone lol

summer torrent
#

docs can help you

solemn latch
#

I dont know what the new method is actually.

I could find out same as you, by looking at the docs

pale vessel
#

doc lists all properties and available methods, it's worth the read

#

it's manager#create

fresh hatch
#

@solemn latch Docs will always work if you read everything

cobalt spruce
#

@pale vessel done

pale vessel
#

done?

#

bruh

cobalt spruce
#

u was saying the true thing

restive pebble
#

:O

cobalt spruce
#

thanks to boeing

restive pebble
#

i dmed u

pale vessel
#

i'm losing brain cells

cobalt spruce
#

lol

#

pepe have no brain

solemn latch
#

🤔

sick cloud
#

looking for some help w/ sorting by date, why won't this put the "newest" one at the top?

#

ie. it's not sorting right

pale vessel
#

isn't this a week old of an issue

cobalt spruce
#

its a furry

modest maple
#

🤔

#

@sick cloud this db based or?

sick cloud
#

nvm i got it sorted

#

but yes

weary ridge
#

does anyone know how to make a video embed ? on discord.py

solemn latch
#

Post the link to the video. It gets made into an embed

#

As long as you have the perm

#

I'm not sure if you can build one.
I think discord prefers it if they build it

weary ridge
#

instead of embed.set_image(url= what do i use?

restive pebble
#

wut lol

#

setImage(some url)

#

lol

solemn latch
#

He wants it to be a video embed

restive pebble
#

lol

#

not possible

#

gif is ok

solemn latch
#

Yeah thought so

weary ridge
#

hmmm i wish tho

restive pebble
#

make gid lol

#

gif

weary ridge
#

😭

restive pebble
#

yes lol

#

u are trying to stream lol

#

bruh moment

weary ridge
#

hmm then maybe is there a way to stop getting vids from reddit e.g filter them out

restive pebble
#

yes lol

#

use gifencoder lol

weary ridge
#

pls kill me

#

hmm wait but thats for node

restive pebble
#

u use python ?

weary ridge
#

yeh

restive pebble
#

lol

#

i wasted ur time

#

then

weary ridge
restive pebble
#

i dont do python

#

but im sure u cannot put videos

weary ridge
#

me = sad

#

lol

lusty quest
#

i think the reddit api returns if the post is a video

weary ridge
#

it keeps sending me vids and comments

#

instead of the gifs and images

restive pebble
#

u can sort the link

#

.gif

#

.mp4

#

like that

weary ridge
#

you have completely broken me

fresh hatch
summer acorn
#

uhm, how do I use Set().has() to get this?
My current code is this

var commands = new Set();
const commandFiles = fs.readdirSync(`./commands`).filter(file => file.endsWith('.js'));

for (let file of commandFiles) {
    let command = require(`./commands/${file}`);
    commands.add({cmd: command, name: command.name});
}
console.log(commands)
console.log(commands.has({ name: `hello` }))

The reason the command handler is like that, is because what I am working on doesn't have the ability to use collections, so a Set was the only other option I knew that wouldn't be too advanced.

restive pebble
#

commands.set

cinder patio
#

You should use Map not Set

restive pebble
#

its for loop lol

#

and use map

weary ridge
#

i havnt used js in a while and it looks ugly

#

lol

solemn latch
#

@fresh hatch did you do the fixes you where told before?

restive pebble
#

@fresh hatch does it throw any error?

fresh hatch
#

just doesn't run

restive pebble
#

if no its not executing lol

cinder patio
#

Set is basically an array, but all the entries are unique, while Map stores key-value pairs

solemn latch
#

You set your commands folder as a file

#

Its

#

./commands

#

Not commands

restive pebble
#

lmao

weary ridge
#

rip

fresh hatch
#

is the anything i need to put here?

#

for how the command is ran

lusty quest
#

is_video is a API value. it returns a Boolean @weary ridge

solemn latch
#

Thats the name

#

And the description

lusty quest
#

with this you can filter out videos

weary ridge
#

oh k

#

thx

fresh hatch
#

i get an error if i remove ./ from ./commands

lusty quest
#

x.data.children[0].data.is_video xpath if you need it

solemn latch
#

You already did remove it

fresh hatch
#
throw err;
  ^

Error: Cannot find module 'commands/ban.js'
solemn latch
#

Where you get the command files

restive pebble
#

bruh moment

fresh hatch
weary ridge
#

k thx @lusty quest

cobalt spruce
weary ridge
#

why do you have every cmd in a file lol i have mine all in one file anyways gtg

fresh hatch
#

xd

hidden summit
#

__dirname may not be the same as process.cwd()

solemn latch
#

Its easier to keep track with a command handler like that

fresh hatch
#

imagining having to scroll 10 years to get to that one command that doesn't work lmao

weary ridge
#

i hate js coz u gotta add(){} every time bloody annoying and confusing lol

solemn latch
#

Reloading individual commands is easier to

restive pebble
#

lol

hidden summit
#

. means cwd in fs readdir but . means __dirname in require

solemn latch
#

{} is easier to keep track of

restive pebble
#

is setting require ok?

#

cmd.run(require("./commands/lol.js"))

#

i never did tho

#

and many peoples do just wondering

earnest phoenix
#

many peoples: exactly

weary ridge
#

oh welp i find it easier without {} so i use python way better atleast ever since i switched to it errors were easier to handle lol

solemn latch
#

Python has better error checking anyway

lyric wedge
#

@boreal rampart

earnest phoenix
#

how can i find a channel category by id? thinking

weary ridge
#

i wanna go back to js coz you get more of a flexibility to do stuff, just wish you didn't need {} also i just started learning html and that is the most easiest thing i have ever done.

earnest phoenix
#

you can code js if you can speak english

lost herald
#

tryna make a jebait command but this doesn't seem to work, but no errors or anything it just stops runningpy elif cmd[0] == 'jebait': user=message.author voice_channel=user.voice.channel if voice_channel != None: vc = await voice_channel.connect() vc.play(discord.FFmpegPCMAudio("jebaited.mp3"), after=lambda: vc.disconnect()) await say('Jebaited!')

earnest phoenix
#

you literally just write what you want and add some ) and }'s

weary ridge
#

lol tru

restive pebble
fresh hatch
#

?

lost herald
#

it shuts down at vc.play

restive pebble
#

mine handeler and reader

#

just take a look maybe helps

fresh hatch
#

can you give me your code in dms?

weary ridge
#

ooooooooooooooooooooooof

restive pebble
#

bruh moment

weary ridge
restive pebble
#

my codes complex

fresh hatch
#

just the command handler

weary ridge
#

the complex the better tho lol

restive pebble
#

that is also the alaises part

solemn latch
#

Did you fix your command loading yet

#

🤔

restive pebble
#

lemme try the require thing now

restive pebble
#

whenever i see someone using the discord.js guide command handeler he has an error

solemn latch
#

Its because they copy paste and don't check what things do

weary ridge
#

lol help me out Messagechannel is not defined .js

#

lol

restive pebble
#

messagechannel KEKW

weary ridge
#

bruh idk

#

lol

#

apparently when v12 came out lots of things changed

solemn latch
#

Yeah some breaking changes

weary ridge
#

it possibly could be message.channel

#

bruh and python be like ctx.send

#

ReferenceError: MessageChannel is not defined

earnest phoenix
#

lol

surreal notch
#

How to define includes

weary ridge
#

im retarded lol

surreal notch
#

;/

restive pebble
#

array has property includes

#

ReferenceError: MessageChannel is not defined
@weary ridge v11?

#

message.channel lol

weary ridge
#

😭

#

i knew it

#

why did they simplify everything?

plucky harness
#

who has bot in over 100 servers?

solemn latch
#

Mines in 12, of my own servers

sudden geyser
#

I do, but why does it matter

placid iron
#

Me

earnest phoenix
#

Me

#

somehow

plucky harness
#

have u filled authorisation form

earnest phoenix
#

yes

weary ridge
#

Mines in 12, of my own servers
@solemn latch i can relate

plucky harness
#

k need ur help

earnest phoenix
#

on what

lusty quest
#

the website is a little bit buggy sometimes

restive pebble
#

12

fresh hatch
#

My bot is in 2 server xd

restive pebble
#

bruh never mind

earnest phoenix
#

das a reasonable amount of servers if your bot isnt that big

#

thats completely fine wym

fresh hatch
#

and my bot isn't even published

lusty quest
#

i reached 100 guilds while only 1 of them is my own server

fresh hatch
#

it's waiting for approval

earnest phoenix
#

cool

fresh hatch
#

cool

lusty quest
#

was worth posting the bot to top.gg

solemn latch
#

Mines in one public server thats not mine

#

Actually 3 now

#

Got a few of my testers putting it in their servers

lusty quest
#

the first puplic server my bot was in got 10k users

solemn latch
#

Oof

lyric wedge
#

@pale elk

lusty quest
#

yes but most of them added them for 1 reason

#

it can spam memes into a chat

#

(there is a 3s delay between the messages)

weary ridge
#

wat do ya mean

#

lol

plucky harness
earnest phoenix
solemn latch
#

🤔

#

.songs ?

earnest phoenix
#

That wont work

#

its a map

pale vessel
#

iterate it

#

get the value or entry

earnest phoenix
#

forEach should work right?

pale vessel
#

yeah

earnest phoenix
#

But it doesnt in my eval cmd :/

pale vessel
#

there's probably a faster method

sick cloud
#

@plucky harness what specifically do you need help with

cobalt spruce
#

(node:11404) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

sick cloud
#

i've filled in 2-3 now

cobalt spruce
#

wtf is this

solemn latch
#

Means your bot couldn't do somethong

#

because it didn't have perms to

#

Like it says

plucky harness
#

what intents should i fill @sick cloud

cobalt spruce
#

@solemn latch IT HAS ADMIN PERM

solemn latch
#

The intents you need

earnest phoenix
#

i forgot to return lmao

solemn latch
#

no bot should have admin perms @cobalt spruce

cobalt spruce
#

@solemn latch uhh

solemn latch
#

There is 0 reason to ever give a bot admin

cobalt spruce
#

soo i dont give any perm

solemn latch
#

Give it the perms it needs

cobalt spruce
#

i tryied to do all the perms

solemn latch
#

No more

sick cloud
#

@plucky harness what does your bot do

cobalt spruce
#

@sick cloud and u?

plucky harness
#

its a game

#

dragon ball game

sick cloud
#

you'd need neither intent then

cobalt spruce
#

@plucky harness OMG GIVE LINk

sick cloud
#

@cobalt spruce?

cobalt spruce
#

what does ur bot do

restive pebble
#

give 8 lol

sick cloud
#

youtube stats

restive pebble
#

8 is enough lol

sick cloud
#

etc

cobalt spruce
#

hmm

#

nice

#

@restive pebble i did BISH

sick cloud
#

/youtube if you want a link

#

on the site

cobalt spruce
restive pebble
#

bruh

#

roblox

cobalt spruce
#

@restive pebble lol

sick cloud
cobalt spruce
#

@sick cloud is not shit

sick cloud
#

this is for development

#

not games

cobalt spruce
#

lol

#

am joking

#

bruh

#

does all furris like this

solemn latch
#

Yikes the sudden toxicity

placid iron
#

how would you recommend guild based leveling database structure?

#

a single table with members then xp per guild in rows

digital ibex
#

guild level?

#

what db u using

placid iron
#

sqlite or postgresql

#

or a new table for every guild

digital ibex
#

yeah, create a new table for each guild.

placid iron
#

ah cool i thought so

#

thanks

digital ibex
solemn latch
#

You can put them all in one table

#

And have user ID and guild ID both be primary keys

#

And index both guild id and user id

#

If you do all of those. When you query the database, it only checks rows with the same guild ID, effectively making it like they are their own tables

placid iron
#

Yeah I just didn't know what's more efficient tbh

#

A massive single table or lots of small ones

solemn latch
#

Databases are good at lots of rows

#

When databases are tested, they are tested in millions of rows typically

placid iron
#

Ok cool thank you

solemn latch
#

If you index properly, im pretty sure your best bet is just one giant table

placid iron
lusty quest
#

did you want to implement global levels?

#

if yes making one DB for everything could be easyer

#

(have one field for local level and one for global level. Local level only runs per guild while global adds each guild ontop)

placid iron
#

Or I could just have the guild Id for global be 0

spare mirage
#

I just made the worst command ever

#

tts

lost herald
#

omg it is so hard to literally play a hardcoded song into a voice channel

spare mirage
#

hardcoded?

lost herald
#

i have a .mp3 file

spare mirage
#

hmm

lost herald
#

and i cant seem to play it (d.py)

spare mirage
#

oof

#

python

lost herald
#

theres just so many layers of weird shit to do

fast trench
#

Can someone help me setup my webhook for DBL?

lusty quest
#

where is your issue?

fast trench
#

it won't do anything

spare mirage
#
bot.on('guildMemberAdd', guildMember => {
    const role = guild.roles.cache.find(role => role.name === 'test');
    const member = message.mentions.members.first();
    member.roles.add(role);
});
```why is this not working?
sudden geyser
#

Do you get an error

spare mirage
#

guild is not defined

#

but why?

restive pebble
#

brruh

sudden geyser
#

Because... it's not defined.

opal plank
#

you are passing guildMember, not guild

restive pebble
#

member.guild

opal plank
#

guild is when you have ecnts such as guildCreate or guildDelete

sudden geyser
#

If you do want the guild the member came from, you can access the .guild property on a GuildMember instance.

spare mirage
#

makes sense

cobalt spruce
spare mirage
#

arrow functions are weird

lyric mountain
#

You get used to them

earnest phoenix
#

me?

spare mirage
#

and im weird

#

so it a connection

lyric mountain
#

Dude, why do you even ask "me?"

restive willow
#

discord.py: I have an on_command_error to listen for errors and send them to the respective channel. Is there a way that I can make a function that isn't a command, that also passes its errors through on_command_error?

cobalt spruce
#

help

earnest phoenix
#

Why did one ask another question right now, so I asked "me?"

lyric mountain
#

Well, my message makes no sense in your error's context

#

Btw, the issue ain't in the code you've shown

cobalt spruce
#

@lyric mountain help man

lyric mountain
#

I can't read ur code

#

Everything is blurry

restive pebble
#

roles.remove lol

cobalt spruce
#
          if (message.content.startsWith(`${prefix}unmute`)){
            if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.reply('Sorry, you do not have permission!');
           var mutedrole = message.guild.roles.cache.find("name", "Muted");
                 var unmutedmember = message.mentions.members.first(); 
                 if (!unmutedmember) return message.reply("Please mention a valid member of this server!") 
                 unmutedmember.removeRole(mutedrole) 
                 .catch(error => message.reply(`Sorry ${message.author} I couldn't mute because of : ${error}`));
                 message.reply(`${unmutedmember.user} has been unmuted by ${message.author}!`); 
          }

restive pebble
#

roles.remove lol

cobalt spruce
#

@restive pebble

#

PS C:\Users\Abdo_Mido\Desktop\islam2> node .
Logged in as Ahx#4022!
(node:15108) UnhandledPromiseRejectionWarning: TypeError: fn.bind is not a function
    at Map.find (C:\Users\Abdo_Mido\Desktop\islam2\node_modules\@discordjs\collection\dist\index.js:158:21)
    at Client.<anonymous> (C:\Users\Abdo_Mido\Desktop\islam2\Bot.js:397:54)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\Abdo_Mido\Desktop\islam2\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Abdo_Mido\Desktop\islam2\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\Abdo_Mido\Desktop\islam2\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\Abdo_Mido\Desktop\islam2\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\Abdo_Mido\Desktop\islam2\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\Abdo_Mido\Desktop\islam2\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
(node:15108) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:15108) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
earnest phoenix
#

uh sorry

#
   const GuildModel = require("./models/guild.js")
    let dPrefix = GuildModel.findOne({ id: message.guild.id });
    const prefissocustom = GuildModel.findOne({
      id: message.guild.id,
      prefix: String
    })

   let prefixes = [`p?` , `P?`, `@obsidian crane `, prefissocustom
]
    let prefix = false;
    for (const thisPrefix of prefixes) {
        if (message.content.startsWith(thisPrefix)) prefix = thisPrefix
    }

    if (!message.content.startsWith(prefix)) return;
let messageArray = message.content.split(" ")`;```
ERROR: 
(node:5980) UnhandledPromiseRejectionWarning: TypeError: GuildModel.findOne is not a function
(node:5980) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by
 throwing inside of an async function without a catch block, or by rejecting a promise which was not handl
ed with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhand
led-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id:
 1)
(node:5980) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, prom
ise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can someone help me?
#

here's the right one

restive pebble
#

.find has some errors

surreal notch
#

3 min= 180000ms ?

restive pebble
#

.find(anything=>anything.name===rolename) @cobalt spruce

surreal notch
#

how to write 3 mins in disord.js

lyric mountain
#

1 second = 1000 ms

#

1 minute = 60 seconds

surreal notch
#

so 3 min= 180000?

restive pebble
#

yes

#

lol

surreal notch
#

nice

restive pebble
#

lol

spare mirage
#

unmuted

#

haha

earnest phoenix
#
   const GuildModel = require("./models/guild.js")
    let dPrefix = GuildModel.findOne({ id: message.guild.id });
    const prefissocustom = GuildModel.findOne({
      id: message.guild.id,
      prefix: String
    })

   let prefixes = [`p?` , `P?`, `@obsidian crane `, prefissocustom
]
    let prefix = false;
    for (const thisPrefix of prefixes) {
        if (message.content.startsWith(thisPrefix)) prefix = thisPrefix
    }

    if (!message.content.startsWith(prefix)) return;
let messageArray = message.content.split(" ")`;```
ERROR: 
(node:5980) UnhandledPromiseRejectionWarning: TypeError: GuildModel.findOne is not a function
(node:5980) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by
 throwing inside of an async function without a catch block, or by rejecting a promise which was not handl
ed with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhand
led-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id:
 1)
(node:5980) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, prom
ise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can someone help me?
#

Btw I use MongoDB as a database

restive pebble
#

idk why he is coding in 50% v12 and other v11

digital ibex
#

thats not his issue.

#

@earnest phoenix what is in the guild.js file?

restive pebble
#

cacheing?

#

lol

digital ibex
#

what

earnest phoenix
#

this:

    const mongoose = require("mongoose")
    exports.run = async(message) => {
       let prefixes = [`p?` , `P?`, `@obsidian crane `]
    let prefix = false;
    for (const thisPrefix of prefixes) {
        if (message.content.startsWith(thisPrefix)) prefix = thisPrefix
    }
    
     const Guild = mongoose.Schema({
      id: String,
      prefix: {
        default: prefix,
        type: String
      }
    })
    
    module.exports = mongoose.model("Guild", Guild)
    }```
digital ibex
#

you dont need that

#

why do u need that

#

wait wait

earnest phoenix
#

?

digital ibex
#

how r u exporting the the file?

earnest phoenix
#

exports.run = async(message) => {
let prefixes = [p? , P?, @obsidian crane ]
let prefix = false;
for (const thisPrefix of prefixes) {
if (message.content.startsWith(thisPrefix)) prefix = thisPrefix
}
I don't think I need so

digital ibex
#

u have exports.run wheres that

restive pebble
#

.run

earnest phoenix
#

uh

#

k

#

u have exports.run wheres that
@digital ibex I will add it

tulip ledge
#

Is there a way to like see wich guild is the biggest one where your bot is in?

digital ibex
#

no no no

#

dont

earnest phoenix
#

uh kk

restive pebble
#

array.sort

digital ibex
#

why do u need that?

  1. its just overcomplicating everything if u were to add it
  2. its a model, nothing else.
  3. everything is just gonna be undefined (because u have the module.exports in the brackets)
earnest phoenix
#

k

digital ibex
#

all u need is the mongoose stuff

#

nothing else

earnest phoenix
#

kk

#

thx

#

for helping me

digital ibex
#

remove everything else

earnest phoenix
#

kk

surreal notch
#

how to get bot uptime in v12?

restive pebble
#

process has an option

digital ibex
#

thats not the bots uptime.

#

use Client.uptime

crisp geyser
#

Hello! I have an issue with my production version. In my machine the bot works just nice.
Production env: OVH VPS, ubuntu 18.x. Using sharding manager.

Bot is running just fine, managed by PM2 with the pm2 start index.js --watch --name bot command. I pull my lastest changes from github, pm2 detects changes in a file so it restarts the bot. Now I have 2 instances running! Why is that? (just happens sometimes)

tulip ledge
crisp geyser
#

Also, I sometimes get this error too (only in production env), maybe it is related?

at process.target.send (internal/child_process.js:679:16)
at Client.<anonymous> (/home/ubuntu/ZSurviveBot/node_modules/discord.js/src/sharding/ShardClientUtil.js:37:17)```
tulip ledge
#

This guy wanted my bot's source code

#

Now he's gonna "hack" me

sudden geyser
#

hackerman

#

for each server ping @ everyone hacker man

solemn latch
#

hacker boi is comin for you

surreal notch
#
require("moment-duration-format");
const duration = moment.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");```
Using this but showing 0 secs
#

everytime

tight plinth
#

Are you sure the format is correct? Try letting your bot run for a minute and retry

surreal notch
#

Ok

crisp geyser
#

If something could take a look to my problem I'd really appreciate it!

surreal notch
tight plinth
#

Apparently your formatting don't work

solemn latch
#

client.uptime?

tight plinth
#

No

surreal notch
#

why

#

how to fix

#

¯_(ツ)_/¯

solemn latch
#

i didnt realize client.uptime exists

surreal notch
#

it shows in ms

#

@tight plinth u k fix?

tight plinth
#

Nope

surreal notch
#

now

tight plinth
#

I dunno how to use moment

surreal notch
#

lol

#

wot u use?

weary anchor
#

who needs help with moment?

#

xD

surreal notch
#

me

weary anchor
#

ask me

surreal notch
#
require("moment-duration-format");
const duration = moment.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");```
#

Showing 0 secs

#

for 5 mins

weary anchor
#

I don't use moment-duration-format

#

I use juration

surreal notch
solemn latch
#

i just made a function that does it

surreal notch
#

wot

solemn latch
#

they are pretty simple

earnest phoenix
#

imagine using a function for uptime

surreal notch
#

big phen sar

weary anchor
#

lol

earnest phoenix
#

¯\_(ツ)_/¯

solemn latch
#

dont need a library

#

🤔

surreal notch
strange trout
#

Imagine importing a package for it

weary anchor
#

I used to use a function for that. But then switche to libs

solemn latch
#

^

surreal notch
strange trout
#

When you can do it locally

weary anchor
#

packages aren't remote. once they are installed, they're local too 👀

strange trout
#

Just make a util class with some methods

sudden geyser
#

I just use the dateformat package

surreal notch
#

||pros has entred the chat||

solemn latch
elfin flower
#

how do i code the bot to change the servers name, pfp, etc..

solemn latch
#

is that actually a useful feature to server owners?
Changing the name and pfp takes an owner only a few seconds anyway

elfin flower
#

im just trying to mess around with bots tbh

solemn latch
#

its one click to get to those menus

sudden geyser
#

^ Big agree with woo, but if you really do want to make it, what library are you using.

elfin flower
#

discord py

sudden geyser
elfin flower
#

yes

#

i think

#

ty lite

#

waiit

#

how does the function work

#

await edit(*, reason=None, **fields).name?

sterile minnow
#

Hey,

I have a question:

How do i get ALL messages from a specific channel and make a Txt file that contains the whole chat. And send the txt then.

Discord.js v^11.5.1

earnest phoenix
#

spam the get messages endpoint until you reach the beginning of the channel

solemn latch
#

api aboose

earnest phoenix
#

this can potentially get you banned and massively ratelimited

#

yeah

solemn latch
#

also, discordjs v11 only will work for a few more months

spare mirage
#

till october

sterile minnow
#

i have a idea. is it possible to log all messages in the txt and if the channel closes then send the txt and delete it from the bot thingy

amber fractal
#

well saving them in a text file unencrypted is against ToS and will get you banned if they ever find out

solemn latch
#

still sounds like api abuse

#

and breach of privacy

amber fractal
#

it is

sterile minnow
#

still sounds like api abuse
@solemn latch i mean if it getas a msg from the channel

earnest phoenix
#

i have a idea. is it possible to log all messages in the txt and if the channel closes then send the txt and delete it from the bot thingy
@sterile minnow
it doesn't matter how you send it, the problem is getting the messages in the first place

#

you seem to be ignoring the fact you'll probably be banned if you do that

sterile minnow
#

and breach of privacy
@solemn latch i will do it like ticket tool

#

send it in a log channel

earnest phoenix
#

are you making tickets

sterile minnow
#

yes

earnest phoenix
#

so just store messages you get from the event lol??

sterile minnow
#

yee

#

i didnt had that idea where i asked

solemn latch
#

use a database

#

not a txt file

earnest phoenix
#

getting all messages in a channel can take minutes or even hours to complete, if you count on the fact you won't get api banned (which you probably will be)

sterile minnow
#

Oki. ty

earnest phoenix
#

so your best bet is to use the event

elfin flower
#

how do i use edit()

earnest phoenix
#

read the docs

solemn latch
#

i think the docs page you where linked had an example

solemn latch
#

ye

#

just use it like any other method in python

#

🤔

tight plinth
#

how yto delete folder + content with rmdir? i forgot how to do that

elfin flower
#

edit(name)?

#

sorry if im being dumb

sterile minnow
#

Hehe i made disord js 11 good for new discord domain

#

i hope

#

yep works

solemn latch
#

i dont know python.
but however you use a method, is how you need to use edit

sterile minnow
#

Just in discord.js/src/client/util/Constants.js

/**
  * HTTP options
  * @typedef {Object} HTTPOptions
  * @property {number} [version=7] API version to use
  * @property {string} [api='https://discord.com/api'] Base url of the API
  * @property {string} [cdn='https://cdn.discord.com'] Base url of the CDN
  * @property {string} [invite='https://discord.gg'] Base url of invites
  */
 http: {
   version: 7,
   host: 'https://discord.com',
   cdn: 'https://cdn.discord.com',
 },
};```

In Line 71 thingy lol
earnest phoenix
#

the domain isnt whats the problem

solemn latch
#

you also need to make v11 work with intents @sterile minnow

earnest phoenix
#

it's the switch to intents and stateless design

sterile minnow
#

then i will upgrade when i need lol

solemn latch
#

it takes like half an hour to learn the changes

sterile minnow
#

I know

#

its just that i did the code decades ago

#

have to learn it again

#

every other bot from me is in 12

finite bough
#

it takes 30 min to learn the changes

#

10 hrs to actually get used to it

solemn latch
#

which is why doing it sooner is better

#

and with intents now being a thing, you might not remember each one you need to make your bot function

#

the longer you wait, generally speaking, the more changes and things you might not know you need to change come up.

sooner than later is better if possible in this case.

elfin flower
#

wait

#

YOETDIGDSGS

solemn latch
#

🤔

elfin flower
#

🤔

solemn latch
#

googling about methods in python.
looks like they are pretty simple
if the guild you want to change is called guild
guild.edit()

#
class Pet(object):
   def my_method(self):
      print("I am a Cat")
cat = Pet()
cat.my_method()

elfin flower
#

i wanna change the name of the server

#

so it would be

#

name.edit()

solemn latch
#

your trying to edit guild isnt it?

#

guild.edit(name: parm)

elfin flower
#

yes

earnest phoenix
#

Keep getting this error with this code?

finite bough
#

post the full error pls

solemn latch
#

means line 16 in your code is upset, whichever line 16 is

#

🤔

finite bough
#

what

#

line 16 of index.js

#

which reads the file ready.js

earnest phoenix
#

@finite bough That is full error.

solemn latch
#

lol

finite bough
#

client is not defined

solemn latch
#

you missed client is not defined

#

the main part of the error

earnest phoenix
#

Ahh, wait.

elfin flower
#

guild for me isnt defined

#

breh

solemn latch
#

🤔

#

am i about to go learn python

#

to solve this issue

elfin flower
#

no

#

maybe

#

i dont know

finite bough
#

guild's value depend on what event u are listening to

elfin flower
#

uh

finite bough
#

using common sense its most probably message event

elfin flower
#

@client.event

finite bough
#

so message.guild

elfin flower
#

I don't see a red line under it anymore

#

yay

slender thistle
#

guild.edit(name: parm)
@solemn latch in Python, kwargs are name=value

solemn latch
#

i was mostly right

elfin flower
#

lol

#

tbh

#

thisvalue = 90

slender thistle
#

name: object = value is type annotation that name is supposed to be an instance of object

elfin flower
#

and thats just cool thats the value is 90

slender thistle
#

You mean default values?

elfin flower
#

uh

#

yes

earnest phoenix
#

ReferenceError: client is not defined

solemn latch
#

ye

#

client needs to be defined

earnest phoenix
#

Mmm, no clue why it's not detecting it

kind sedge
#

Here

finite bough
#

@earnest phoenix did u define the client in ur main file?

kind sedge
#

I HATE PHONE

#

I TYPE SO SLOW

earnest phoenix
#

Yeah, works completely fine until added the new ready.js code

solemn latch
#

client should be defined very early on in your program

finite bough
#

try exporting client from index.js to ready.js

earnest phoenix
#

mhm

solemn latch
#

define things before using them @blazing ravine

blazing ravine
#

can u help me :?

restive furnace
#

he helped you

blazing ravine
#

i dont know how xd

restive furnace
#

define things before using them @blazing ravine

blazing ravine
#

i need help how t odefine

#

my english is bad i did not understand sorry

earnest phoenix
#

try exporting client from index.js to ready.js
@finite bough how

blazing ravine
#

im tryed to make after give undefined error return and send another messaage but didnt work

earnest phoenix
#

my bot same thing in a way

dusky marsh
restive furnace
#
let var= /* object */ 1;
console.log(var);```

this is working, but if you do like this
```js
console.log(var);
let var = 1;``` 

error comes out