#development

1 messages · Page 1183 of 1

drifting wedge
#

but how do i get it to send the pictures

cinder patio
#

<name:id> for non animated emojis AFAIK

hazy sparrow
#

fix my problem someone KEKW

misty sigil
#

what next? It gives you a role on every message?

drifting wedge
#

like it sends emoji info

steady anchor
#

if(!welcomechannel.permissionsFor(member.guild.me).has('SEND_MESSAGES'))return
@misty sigil thx

misty sigil
#

no prob!

hazy sparrow
#
 message.channel.send(`Successfully purged **${deleteAmount}** messages.`).then(m=>{m.delete(5000)})

its not deleting after 5 secs

cinder patio
#

Any errors?

misty sigil
#

use set timeout

hazy sparrow
#

nope

#

no error

cinder patio
#

Does it not delete at all, or does it get deleted immidietly?

hazy sparrow
#

doesesnt delete at all

#

heres the full code

#
 else {
            deleteAmount = parseInt(args[0]);
        }
    
        message.channel.bulkDelete(deleteAmount + 1, true);
        message.channel.send(`Successfully purged **${deleteAmount}** messages.`).then(m=>{m.delete(5000)})
    
sudden geyser
#

bow pro what Discord.js version are you using

hazy sparrow
#

v12

sudden geyser
#

.delete() takes an object.

#

Give it an object with a timeout key

#

In milliseconds

hazy sparrow
#

ty

cinder patio
#

hmm.. would that be a reason for the message to not get deleted at all though

sudden geyser
#

If you pass anything other than an object it throws an error.

hazy sparrow
#

theres a promise rejection warning, does that count?

sudden geyser
#

Yes

cinder patio
#

of course it does

#

it's an error

calm saddle
#

i basically gave up on my d.js bot cause glitch decided to ban people from using external hosters :\

sudden geyser
#

You mean pingers.

earnest phoenix
#

@calm saddle heroku ?

faint prism
#

Use a VPS to run the bot service ||or Self-host||

earnest phoenix
#

he wants free

#

host

calm saddle
#

yess

misty sigil
#

imagine hosting on glitch
reasons it’s bad

  • Low RAM
  • Ratelimits
  • Low disk space
faint prism
#

free

restive furnace
#

fReE

calm saddle
#

lmaoo

misty sigil
#

any """""""""""free""""""""""" hosting is either:

  1. not intended to be used as hosting for bots
  2. not actually suitable for hosting for bots
  3. not actually free
  4. will get your token stolen
  5. all of the above
faint prism
#

free vps (by some rando) = getting bot token stolen

cinder patio
#

Usually free tiers only get used for prototyping.

#

Not for any serious projects

calm saddle
#

i rather not spend money ._.

misty sigil
#

well Shrug

#

vpses arent even that expensive

faint prism
#

I'd imagine when people are like, "Oh yeah I'll host your bot for free", they just want to steal the token and snoop your files you put on their server

cinder patio
#

Prices start at around 2.50$

misty sigil
#

yea like I could give you a free mongodb cluster and free hosting

#

but guess what

faint prism
#

👁️ I C all of it

misty sigil
#

your tokens been yoinked floshed

#

your data’s been yoinked floshed

sudden geyser
#

If you don't want to pay there are some alternatives, like having a GitHub student pack and using AWS cloud

misty sigil
#

your bot goes offline forever because you had no backups floshed

cinder patio
#

I mean, what's the token for if the bot isn't online in the first place

#

i doubt it would be in any servers

misty sigil
#

still

#

I could wait for it to grow

#

implement server logging

#

hits 100 servers

#

POOF, gone

cinder patio
#

DigitalOcean gives you 500 credits that last for 2 months

faint prism
#

The token will be plaintext on runtime in memory anyways, just don't use sketchy VPSes and you'll be good ||probably||

misty sigil
#

so basically don’t trust randos for hosting

calm saddle
#

I just use a chrome a extension to reload my bots glitch webpage (you know the one used to ping it) and reload that page every 5 sec but that requires me to leave that page open =_=

misty sigil
#

just host it on your pc then

faint prism
#

well I love having a headless server with my bot's process runnning as a systemctl service

misty sigil
#

well I love having a headless server with my bot's process runnning as a systemctl service
@faint prism same

faint prism
#

I use a rasp pi 4, I need a UPS though 😛

cinder patio
#

You're just trying to cheat the system at this point, you'd be better off just getting a cheap VPS. Even a 1 core 1 GB memory would be good to start with

misty sigil
#

I use a vps cus I physically cannot be arsed to hold up that laptop I was using to host before

faint prism
#

or even 1 core, 512Mb ram, 10 GB hdd mmLol

cinder patio
#

That would cost... around 2 bucks a month

faint prism
#

tbh server space is so cheap

dull badger
faint prism
#

$0.06 a day, or $0.003 an hr

cinder patio
#

Pass a function instead of a string

faint prism
#

^

sudden geyser
#

Speak of the devil, it's Glitch

calm saddle
#

:0 heyll naa

misty sigil
#

help 😭
@dull badger you need to pass an arrow function

#

e.g.

solemn leaf
#

is t possible to pull a random image from google drive?

faint prism
#

probably

restive furnace
#

no

#

get a vps honestly

faint prism
#

Is this a promotional ad? l0l?

solemn leaf
#

I have a folder with 100k pictures

#

and that isnt a joke I have 100k folders in it

faint prism
#

I have a folder with 100k pictures
@solemn leaf I could see you having an array of gdrive image links and selecting one at random

restive furnace
#

theres api i believe

faint prism
#

yeah, gdrive api

sudden geyser
#

Wanna know a way to host a discord bot 24/7 free? Use repl.it, a lot better than glitch.
@hollow snow how so? repl.it is not meant for hosting Discord bots either.

faint prism
#

so populate a collection of gdrive image links via their api, then select one at random

dull badger
#

@misty sigil İf i send you a invite link in glitch can you fix

#

bcs i dont understand you

misty sigil
#

glitch

#

no

sudden geyser
solemn leaf
#

how do use gdrrive api

faint prism
#

Use a library for it

solemn leaf
#

is it like a npm?

faint prism
#

probably a package there, yeah

hollow snow
solemn leaf
cobalt spruce
#

@hollow snow yup

restive furnace
#

its ment to test things

#

not to host in prod

hollow snow
#

whatever but as long as it works

#

I used uptimerobot to ping it

restive furnace
#

"as long as it works" cough

solemn leaf
#

maybe the ping is like 10000 ms but it works

sudden geyser
#
  1. That is not an official blog from repl.it like free said.
  2. You could use that same method on Glitch in the past until they started blocking bots.

Hosting on repl.it is no better than hosting on Glitch. They both do the same thing and come at the same cost. Just because it "works" doesn't mean it's a good solution.

restive furnace
#

glitch v2 ping is around 2 minutes (in ms multiply 2 by 60 and then with 1000)

faint prism
#

When I first made a bot, I just left the process running and my desktop on 24/7 for a week lol

restive furnace
#

but it works

hollow snow
#

When I first made a bot, I just left the process running and my desktop on 24/7 for a week lol
@faint prism bruh

restive furnace
faint prism
#

Nothing wrong with that, just not efficient power consumption-wise

hollow snow
#

True

#

Use rpi

faint prism
#

Use rpi
@hollow snow I was waiting for it to arrive in the mail

hollow snow
#

resberry pi

faint prism
#

don't ask what the failed to resume error is, I've been assured that's normal ||I hope😐||

earnest phoenix
#

the NQN bot is deleted?

hazy sparrow
#
if(parseInt(args[0]) > 100) {
            message.channel.send('You can only purge 100 messages at a time.')

it doesent even sedn the message. only console logs this when i never made it log anything

solemn leaf
#

What Im trying to do is get a random image from this https://thispersondoesnotexist.com/image

hazy sparrow
#

and it says "Sucsessfully purged undefined messages "(i made it to do that)

solemn leaf
#

but it loads the image but If I run the command again it is the same image

lament meteor
#

discord cachin

#

the only thing u could rlly do is send the bytes

solemn leaf
#

?

earnest phoenix
#

how can i edit the javascript new Date() format?
i want to do dd /MM/yyyy HH:mm
now i'm using this: new Date().toLocaleString ("tr-TR"))

#

output: 2020-8-24 19:01:39

broken arch
#

@steady marsh

#

m!help

earnest phoenix
#

@earnest phoenix you should use moment module

#

yardım etsene kanka

heavy marsh
#

Does anyone know a good host from Music + General Purpose bot

hazy sparrow
sudden geyser
#

Show us your code

#

Where you tried bulk deleting.

hazy sparrow
#

wait hold on

solemn leaf
#

you have to

#

bulkDelete(number)

hazy sparrow
#
       const prefix = "bow"
       
        const args = message.content.slice(prefix.length).trim().split(/ +/);
        const command = args.shift().toLowerCase(); 
        
        
        
        if(!message.member.permissions.has('MANAGE_MESSAGES')) return message.channel.send("You don't have the permission to do this action.");

        let deleteAmount;

        if(isNaN(args[0]) || parseInt(args[0] <= 0)){return message.channel.send('Please input a valid number next time.')}

        if(parseInt(args[0]) > 100) {
            message.channel.send('You can only purge 100 messages at a time.')
        
        }else {
            deleteAmount = parseInt(args[0]);
        }
    
        message.channel.bulkDelete(deleteAmount + 1, true);
        
        if(!deleteAmount === 'undefined') {
        message.channel.send(`Successfully purged **${deleteAmount}** messages.`).then(m=>{m.delete({ timeout: 5000 })})
        }
    
    if(deleteAmount === 'undefined'){
        return;
    }
    
}
    
 }
opal plank
#

rule of thumb, bad idea to ignore errors

hazy sparrow
#

rule of thumb, bad idea to ignore errors
@opal plank it deletes as i wanted it to. it just shows that in the console

opal plank
#

well i dont see anything in console. so its error'ing somewhere

#

debug it

#

vsc has amazing debugger tools

#

step debug and see where the error is thrown

hazy sparrow
#

should i worry about this? my commands work perfectly
this is the console ss

opal plank
#

im well aware, doesnt change what i said though

#

handle your errors

hazy sparrow
#

lemme debug hold on

opal plank
#

dont spam ur console with errors

hazy sparrow
#

im on 32bit :/

opal plank
#

none of my business, but you should update to 64x

#

a LOT of shit nowadays dont support 32x arch

cobalt spruce
#

0.0

hazy sparrow
#

yup, ik

sudden geyser
#

@hazy sparrow there's no guarantee parseInt will be able to convert the string into a number. It'll likely return NaN if it can't. You should see what the value of deleteAmount is before you try bulk deleting messages (in a debugger like Erwin said).

opal plank
#

^^

hazy sparrow
#

hmm so can i just console.log deleteAmount?

opal plank
#

you need to see where the error is being thrown beforehand

#

also you arent dealing with normal api errors

sudden geyser
#

Also here's a possible typo: parseInt(args[0] <= 0)

Did you mean to move the <= less than or equal to sign outside this function (this is not what causes the error)?

opal plank
#

like 7+ days older

#

if message is older than 7(or 14, i forgot) days it'll error

sudden geyser
#

14 days

opal plank
#

you should handle rejections

hazy sparrow
#

Also here's a possible typo: parseInt(args[0] <= 0)

Did you mean to move the <= less than or equal to sign outside this function (this is not what causes the error)?
@sudden geyser nope, its exactly what i want

opal plank
#

it'll resolve the () first iirc

sudden geyser
#

You're trying to see if a string is greater than or less than a number, then passing the value (true/false) to parseInt()

#

That does not make sense.

opal plank
#

args[0] typeof string <= smaller or equal than 0 type of number

#

you cant compare different types

#

even if it does compare, you are parsing true

hazy sparrow
#

i think i got it where the rejection is there, brb

opal plank
#

check the pic i sent

#

this is why Ts is glorious, you catch stupid shit like that, where Js just be like
hahaha, code goes BRRRR

rocky hearth
#

How can I play a silence audio?

hazy sparrow
#

this is why Ts is glorious, you catch stupid shit like that, where Js just be like
hahaha, code goes BRRRR
@opal plank whats Ts

#

never heard of it

opal plank
#

TypeScript

hazy sparrow
#

oh that

opal plank
#

TipusScruptus

cunning parcel
#

hi

hazy sparrow
#

@hazy sparrow there's no guarantee parseInt will be able to convert the string into a number. It'll likely return NaN if it can't. You should see what the value of deleteAmount is before you try bulk deleting messages (in a debugger like Erwin said).
@sudden geyser it just says "Successfully purged NaN messages." and doesesnt delete any messages

opal plank
#

did u bother reading the image i sent?

hazy sparrow
#

yup

#

i didnt understand anything

opal plank
#

here

#

lets do step by step(which you would see in step debugging)

dusty tulip
#

My friends want to activate his bot

opal plank
#

parseInt(args[0] <= 0)

#

thats what u got, correct?

hazy sparrow
#

yup

dusty tulip
#

But it always say error

opal plank
#

so, it'll resolve the () first, whats inside

#

which is args[0] <= 0

hazy sparrow
#

correct

opal plank
#

args[0] lets assing '1' as a dummy value

dusty tulip
#

cmdd keeps referring the bot token as reference error and idk how to fix

#

So?

opal plank
#

so '1' <= 0

you are comparing '1' which is a string to 0 which is a number

#

that will return NaN

#

actually

hazy sparrow
#

wot?

opal plank
#

nvm js allows it

#

but

#

see it returns true

faint prism
#

lol

opal plank
#

then you are trying to parseInt(true)

hazy sparrow
#

yep

opal plank
#

its retarded that you can compare strings and numbers

dusty tulip
#

@opal plank visual studio code?

#

Hmm

opal plank
#

yes

#

parseInt(true) = NaN

#

cuz true isnt a number

golden condor
#

true = 1

faint prism
#

that's the problem with implicit conversions

opal plank
#

which is also stupid cuz true is 1

golden condor
#

try true + true

opal plank
#

im aware

#

but it doesnt work like that

golden condor
#

ok

opal plank
#

just remember this bow

dusty tulip
#

cmd eeps referring the bot token as reference error and idk how to fix

Someone can help? The token

opal plank
#

compare things of same type

#

'1' is a string

#

1 is a number

faint prism
#

Someone can help? The token
@dusty tulip make sure the variable has a value

opal plank
#

you cant compare them

#

even if shitty Js just runs it

#

though its wrong

hazy sparrow
#

lmao

opal plank
#

Ts catches that before you even attemp to do such stupid thing

#

as you can see here

dull badger
hazy sparrow
#

i'll probably shift to typescript in the future

opal plank
#

parseInt on your args first

#

then isNaN it

#

to make sure its a number

hazy sparrow
#

a

#

a

#

a

opal plank
#

or the other way around, shouldnt matter too much

hazy sparrow
#

a

earnest phoenix
#

Who know coding with BDScript?

hazy sparrow
#

wait why did i send a

earnest phoenix
#

Pls

opal plank
#

idk

hazy sparrow
#

i meant to backspace

opal plank
hazy sparrow
#

-_-

ocean zinc
#

hi

earnest phoenix
#

Hi

dusty tulip
#

@dusty tulip make sure the variable has a value
@faint prism ok (sorry for the late respond)

dull badger
opal plank
#

OMG

#

STOP

dull badger
#

how to fix

#

undefined

opal plank
#

d.js has a addFields()

#

FIELDS

#

plural

#

not even gonna bitch about using Embed Builders in this case

dull badger
#

b-but havent with ()

opal plank
#

just pls use addFields()

hazy sparrow
#

@opal plank you should see my rock paper scissors code lmao

faint prism
#

@opal plank I'm glad C# doesn't allow those conversions. Makes more since not to be able to tbh.

dull badger
#

with s

#

okey

opal plank
#

the one that we made here?

hazy sparrow
#

you were there too?

opal plank
#

i was actually helping

hazy sparrow
#

oh yea

#

im dum dum

opal plank
#

@faint prism C# is right, js is the fuckboy of the group who just compiles whatever you throw at it. Shit is like weed, it'll grow even on concrete

faint prism
#

weeds? lol

opal plank
#

never seen weed managing to grow on concrete?

hazy sparrow
#

"Shit is like weed"

faint prism
#

Only reggie

opal plank
#

actually

#

here

#

prob shtipost but technically development

#

eh not good enough of a meme to make

dull badger
#

@opal plank

#

it dont works now

#

with addfields

opal plank
thin turret
#

Wtf

opal plank
#

im gonna pretend i did not see that

thin turret
#

Yanderedev code

opal plank
#

yandere doesnt have that much of a big brain

sonic lodge
#

it's undefined because you aren't providing a value for the second argument of addField()

opal plank
sonic lodge
#

and the point of addFields is to not have to write addField over and over

opal plank
#

or this if you need an example

#

preferably you wouldnt even use embed builders in the first place

dull badger
#

can you fix for me bcs i dont understand you @opal plank

opal plank
#

i cannot spoonfeed

sonic lodge
#

it's undefined because you aren't providing a value for the second argument of addField()

eternal osprey
#

hey guys

opal plank
#

i provided you both docs and OOPLED told you why

eternal osprey
#

i am trying to start my bot on my vps

#

and it is online

#

(using pm2)

#

but when i try to run a command:

#

it doesnt res[pmd

dull badger
#

@sonic lodge what

opal plank
#

probably bad path

sonic lodge
#

as you can see, .addField() takes 2 parameters and 1 optional one

#

you have the name, but left the value blank

dull badger
#

WHY MY MFCKR BRAİN DONT UNDERSTANDS THATS

eternal osprey
#

@opal plank i am pretty sure all the paths are assigned accordingly

#

because when i start the bot on vsc

#

it works

#

without a problem

opal plank
#

are you using absolute or relating pathing?

#

actually i dont even know what lang you using

eternal osprey
#

i am using discord,js and javascript

opal plank
#

what is the path or dir you're using?

eternal osprey
#

let me make a screenshot

#

hold on

opal plank
#

aight

eternal osprey
#
fs.readdir("./commands/", (err, files) => {
  if (err) return console.log(err);

  console.log(`Loading ${files.length} commands:`);

  files.forEach((file, i) => {
    if (!file.endsWith("js")) return;

    const props = require(`./commands/${file}`);
    const commandName = file.split(".")[0];
    console.log(`Attempting to load command ${i+1} of ${files.length}: ${commandName}`);
    client.commands.set(commandName, props);
  });
});
client.login(process.env.BOT_TOKEN);  ```
faint prism
#

WHY MY MFCKR BRAİN DONT UNDERSTANDS THATS
@dull badger to use a function, you have to provide it with arguments for any parameters it requires ||except for the optional ones||

eternal osprey
#

pretty sure this is the part

opal plank
#

you sure the folder is called commands on your vps?

#

it really sounds like a bad dir name

eternal osprey
#

it is

#

let me get it for you

opal plank
#

aight

faint prism
#

it really sounds like a bad dir name
@opal plank That's you're opinion ||and mine as well :)||

opal plank
#

no one asked for your ||100% correct and agreeable|| opinion @faint prism

eternal osprey
#

it's in there

#

otherwise vsc wouldn't work either

opal plank
#

thats in the vps?

eternal osprey
#

yeah

opal plank
#

its the vps we debugging, since its not working there

eternal osprey
#

the file manager

#

for vps

opal plank
#

hmmm

eternal osprey
#

should i send my whole file?

#

or ofc that cannot be the problem

#

it is inside the vps

#

cuz the file itself debugs fine

opal plank
#

can you console log client.commands and see if it has help?

#

actually, better yet

#

is ANY commands working?

zenith terrace
#

@opal plank hows the whitenames mmLul

opal plank
#

what whitenames?

eternal osprey
#

hmm

#

let me try again

opal plank
#

oh

#

@zenith terrace going as usual

zenith terrace
#

Lol

hazy sparrow
#

@opal plank wait m8 but why does it give the rejection warning only when i try to purge over 100 messages?

opal plank
#

@hazy sparrow it gives you a lot of warnings

#

missing permissions, older than 14 days, over 100 messages, no index

#

you gotta handle it before sending it wherever you can

#

you should not use the api as your error catcher

hazy sparrow
#

it says "There was an error: Cannot delete messages which are over 14 days old"

eternal osprey
#

gwt guy

#

hey guys

hazy sparrow
#

when i try to delete over 14d old

eternal osprey
#

i am fucking stupid

opal plank
#

which is what i told you would happen

eternal osprey
#

i actually had set up a prefix command for each guild

#

and i added the bot with the wrong prefix

opal plank
#

big oof

#

wait what

eternal osprey
#

however @opal plank thanks for the help man!

opal plank
#

did u hardcode your prefix?

eternal osprey
#

i have made a $setconf prefix ...

#

command

opal plank
#

howcome that was the error though?

eternal osprey
#

but it is different for each guild

#

i had the bot in my old server

#

where the prefix was $po

#

but in the new guild the default 9set by me) was %

opal plank
#

but why is it even trying to get the command if the prefix should be false?

#

return if prefix doesnt match before attemping to run command

#

if the prefix was faulty, it shouldnt have ran that command in the first place

#

cuz, y'know, not the prefix of the guild

eternal osprey
#

because my other bots

#

(distance calculator and weather bot)

#

actually DO run with $po

#

which means that they were responding to the command

#

eventhough they didn't have a command named $po help

opal plank
#

im still confused

#

if its a different bot why is it running on your main process?

eternal osprey
#

i've got no clue

earnest phoenix
#
let level = db.all().filter(data => data.ID.startsWith(`guild_${message.guild.id}_level_`)).sort((a, b) => b.data - a.data);

let xp = db.all().filter(data => data.ID.startsWith(`guild_${message.guild.id}_xp_`)).sort((a, b) => b.data - a.data);

var xpLb = "";
for (var i in level, xp) {
xpLb += `\`#${level.indexOf(level[i]) + 1}\`${bot.users.cache.get(xp[i],level[i].ID.split('_')[1]).tag}(**${level[i].data}** Seviye, **${xp[i].data}** XP)\n`
};

const embed = new MessageEmbed()
   .setTitle(`${message.guild.name} - XP Lider Tablosu`)
   .setColor("#9eced8")
   .setDescription(xpLb)
   .setTimestamp()
   .setFooter(`${message.author.tag} | © autimatic`, message.author.avatarURL({dynamic:true}))
message.channel.send(embed);

TypeError: Cannot read property returns an error of 'tag' of undefined.

the ${bot.users.cache.get (xp [i], level [i] .ID.split ('_') [1]). tag} part should not be wrong. what should i do

#

@earnest phoenix show ur model

#

model? do you mean the codes

#

@earnest phoenix i dont understand what are trying to do : /

#

but

#
bot.users.cache.get("ID")
#

must be so

#

i already know it.

#

@earnest phoenix i see that u use something like

bot.users.cache.get("xp, ID")
#

it is written on this line : ${bot.users.cache.get(xp[i],level[i].ID.split('_')[1]).tag}

#
xp[i],level[i] ???
#

why there is a comma

#

,

#

????

#

@earnest phoenix

#

i've fixed it now. same error again.

#
            xpLb += `\`#${level.indexOf(level[i]) + 1}\` ${bot.users.cache.get(level[i].ID.split('_')[1]).tag} (**${level[i].data}** Seviye, **${xp[i].data}** XP)\n`
#

@earnest phoenix how ur xp look like ?

#

@earnest phoenix bruh

xp[i].level[i]
#

not level[i] i think

#

xp doesn't matter right now. let's solve this

#
let level = db.all().filter(data => data.ID.startsWith(`guild_${message.guild.id}_level_`)).sort((a, b) => b.data - a.data);
#

I described above

#

@earnest phoenix what is the error ?

#

cuz i am not good in mongo

#

i know only mongoose

#

: /

#

like i can use only mongoose

#

exist from the same line of code. the other command works but this one doesn't. i'm so confused

eternal osprey
#
  const [prop, ...value] = args;
  const values = value.join(" ").split(/, |,/g);

  const isAlpha = value.join("").match(/[A-Za-z0-9]/gi);

  if (prop == "prefix"  && isAlpha)
    return message.author.send(botspeech.requiredPrefix);```
earnest phoenix
#

@earnest phoenix no clue

#

: /

eternal osprey
#

how do i make sure i can use $po in my prefix

#

because now i get the error that i cannot use alphanumerical characters

cloud pebble
#

Anyone got any idea why bot.wait_for('message') would only work for some servers and not others?

earnest phoenix
#

@eternal osprey

if(!message.content.startsWith("$po"))  return ;
``` ??
#

@cloud pebble

bot.on("message", message => {
//code
})
eternal osprey
#

no nguyen

#

i have a setconf prefix ... command

#

but if i use $po for some reason

#

it tells me to use non-alphanumeric characters

#
  const [prop, ...value] = args;
  const values = value.join(" ").split(/, |,/g);

  const isAlpha = value.join("").match(/[A-Za-z0-9]/gi);

  if (prop == "prefix"  && isAlpha)
    return message.author.send(botspeech.requiredPrefix);```

@eternal osprey i am sure the problem relies in here

#

but i cannot find it

cloud pebble
#

@earnest phoenix i code in python so

message = await bot.wait_for('message', check=predicate, timeout=5)```
It is able to pass the predicate in only some servers, but fails in others
#

Only recently started happening too

earnest phoenix
#

@cloud pebble oh nvm then

sudden geyser
#

@cloud pebble is it throwing an error because it's timing out?

cloud pebble
#

It is throwing the timeout error but extending the timeout doesn't fix it either

sudden geyser
#

Then are you sure the predicate is returning True? What exactly is the predicate you give it?

cloud pebble
#
def predicate(message):
    return message.channel.id == ctx.channel.id and message.author.id == #####

The predicate checks the message to see if it's from a specific user (the # is replaced with the user ID in the final code) and it definitely returns True, just not in all servers with the bot in

sudden geyser
#

Yeah so if it doesn't return True in some servers and the timeout is being exceeded, it throws the timeout error?

cloud pebble
#

Yep

#

Which I'm guessing is because it can't read the message, but the weird thing is this only recently started happening

sudden geyser
#

Unless I'm mistaken, isn't that expected behavior? The timeout is exceeded so it throws the timeout error. In some servers it doesn't return True because no messages received actually returned True from the predicate. Also if ##### is supposed to be a user ID, is it also hardcoded and would limit the predicate to only work for one user?

cloud pebble
#

That's the point, it's a third party bot listening for another bot. I'm trying to figure out why the timeout is being exceeded when the message is clearly there and doing the exact same thing is working in other servers

earnest phoenix
#

how do i make a changig prefix like ! prefixset 1 and the the prefix chagegs to 1

misty sigil
#

Do you know database?

sudden geyser
#

Silent you could try logging the value of message and ctx in the predicate to see if it's being called at all, or which fields don't match (either with print or a proper debugger).

earnest phoenix
#

nooo......

misty sigil
#

If not, try quick.db

sudden geyser
#

You'll need some form of database to do that.

earnest phoenix
#

whats that

#

npm i quick.db

misty sigil
#

an easy npm package

earnest phoenix
#

ok thenº

#

what do i do

misty sigil
#

You can set stuff easily

#

db.set(${message.guild.id}_prefix, "prefix")

earnest phoenix
#

oh

#

ok

#

i put that on the const PREFIX =

misty sigil
#

and then db.get(${message.guild.id}_prefix)

earnest phoenix
#

right

misty sigil
#

No

earnest phoenix
#

then wait

#

isnt

#

db.set(${message.guild.id}_prefix, "prefix")

#

and

#

the same

misty sigil
#

bruh

earnest phoenix
#

oh one is set other is get

#

lol

misty sigil
#

yes

earnest phoenix
#

so i put that where

steady anchor
#

can i do a query in a query?

#

(mysql)

earnest phoenix
#

that code is for what ?

misty sigil
#

const prefix = db.get(${message.guild.id}_prefix) ? db.get(${message.guild.id}_prefix) : "default prefix"

earnest phoenix
#

oof idk mysql

#

const prefix = db.get(${message.guild.id}_prefix) ? db.get(${message.guild.id}_prefix) : "default prefix"

#

like this right

misty sigil
#

I legit just gave you all the prefix things

earnest phoenix
#

ok

#

buut y are they both

#

get

#

wheres the set

misty sigil
#

you don’t need set

#

that’s if it gets its that prefix

#

if it doesn’t get its default prefix

earnest phoenix
#

ok

#

then now how people change the prefix

opal plank
#

probably a good idea to cache the prefixes rather than call on every command

earnest phoenix
#

sory being anoying im very dumb

misty sigil
#

yes ^

opal plank
#

map them and change when prefix change

misty sigil
#

it’s smart

earnest phoenix
#

map them and change when prefix change
@opal plank wdym

opal plank
#

you know whats a map() ?

earnest phoenix
#

no.....

opal plank
#

then start from there

earnest phoenix
#

okay

opal plank
#

here

#

take a look at this and try a couple snippets till you get the hang

#

maps are important basics of js

earnest phoenix
#

ok

#

thx

opal plank
misty sigil
#

can I use cache ? cached : get ? get : default

#

or what

opal plank
#

you can chain them

#

i assume that'll work fine

misty sigil
#

ok cool

cinder patio
#

Wait what are you trying to do

misty sigil
#

prefix cache

earnest phoenix
#

@opal plank i still dont understand

#

i loked around

misty sigil
#

I’d just assume that’d be quicker than the spaghetti I have now

opal plank
#

hmm

earnest phoenix
#

but i didnt understand

opal plank
#

map is basically the result of an object and an array fucking eachother and getting a malformed child

earnest phoenix
#

like i understaded that i can create new map with new map()

cinder patio
#

const prefix = cached || await fetched() || "default" you can do this without ternery

opal plank
#

map is where you map your values

earnest phoenix
#

map is basically the result of an object and an array fucking eachother and getting a malformed child
@opal plank lol

misty sigil
#

yes I could

opal plank
#

contacts is a new map

#

that map is empty

earnest phoenix
#

ok

opal plank
#

now you set(key, value)

earnest phoenix
#

i understanded (i think)

opal plank
#

like an object

earnest phoenix
#

yes and

opal plank
#

property name : value

#

now to check if it exists

#

cuz now we added Jessie in it

#

now the map has one entry (size 1)

earnest phoenix
#

um

#

hum...

opal plank
#

map.has(bob) => false , only jessie is in the map

earnest phoenix
#

ok

opal plank
#

here

earnest phoenix
#

but sorry

opal plank
#

you seem to be strafing here

earnest phoenix
#

im still too DUMB

misty sigil
#

then don’t add a custom prefix

earnest phoenix
#

i need

#

to

opal plank
#

let a = {
bob: 1,
foo: 2,
};

steady anchor
earnest phoenix
#

but ill try to look around

opal plank
#

imagine that example that i got

earnest phoenix
#

with that website

opal plank
#

trying to give you a mowed down explaination

earnest phoenix
#

i know

#

but you can call me dumb

#

bc i am

opal plank
#
let a = {
bob: 1,
foo: 2,
};
#

imagine this

#

what is this?

earnest phoenix
#

yes

#

the map

opal plank
#

no

earnest phoenix
#

contact

misty sigil
#

a.bob = 1
a.foo = 2

opal plank
#

again, what is { } in js?

misty sigil
#

it’s an object

opal plank
#

ding ding correct

#

thats an object

misty sigil
earnest phoenix
#

ok

opal plank
#

how do you get the value foo of a?

misty sigil
#

a.foo

earnest phoenix
#

new map()

opal plank
#

jemerey

earnest phoenix
#

lol

#

thats cute

opal plank
misty sigil
#

sory

opal plank
#

you need to learn the basics of js my dude

#

its an OOP lang

earnest phoenix
#

me is sad

opal plank
#

you cant use a Object Oriented Programing language without knowing, well, objects

earnest phoenix
#

oh

#

let a = {
bob: 1,
foo: 2,
};

opal plank
#

yes

earnest phoenix
#

it means that bob and foo is an object

opal plank
#

wrong

#

a is an obect

#

foo and bob are properties

earnest phoenix
#

oh right

opal plank
#

lets try this again

#

how do you get value of bob?

earnest phoenix
#

bob: 1,

opal plank
earnest phoenix
#

lol

opal plank
#

im really trying dood

earnest phoenix
#

i know

#

im dumb

#

uknow

opal plank
#

i assume you havent started coding yet

earnest phoenix
#

yes i did actualy

opal plank
#

bad

earnest phoenix
#

and it works

#

it ha

#

has

opal plank
#

you'll screw yourself up jumping into bot development without knowing the lang

earnest phoenix
#

clear ban kick

opal plank
#

you has been copying codes over and over

earnest phoenix
#

and

cinder patio
#

Think about it in this way: A Dog is an object. To get the dog's eye color, you would do Dog.eye_color. eye_color is a property of the Dog object.

earnest phoenix
#

oof

opal plank
#

you arent developing, you are copying

earnest phoenix
#

no im not

#

:mad:

opal plank
#

you are tho

earnest phoenix
#

no im not

opal plank
#

you simply cant code a bot if you dont know what an object is

earnest phoenix
#

dude

#

i didnt know that was an object

#

but i can code without knowing it

#

i didnt copy

fervent goblet
#

can i find an item in array with js like?

if(thresholdData.threshold.includes({role: rolename.id, level: lvl})) return message.reply('You already have this set as a threshold!')
opal plank
#

legends say if you react too fast you get ratelimited

cinder patio
#

no, you would have to use the some function

opal plank
fervent goblet
#

ok

#

ty

earnest phoenix
#

well ill try to learn more of js

#

reeeeeeee

#

but i do know some basics

#

:mad:

#

@earnest phoenix watch some yt tutorial

opal plank
#

no

#

stop telling people to watch youtube

earnest phoenix
#

:spray:
@opal plank yes

opal plank
#

videos bad

earnest phoenix
#

i know basics

#

or read docs

#

: /

#

lol

#

:/

#

@opal plank yt is good in some way

opal plank
#

use documents, they are up to date and give you a good practice on relying on documents rather than youtube videos

earnest phoenix
#

no its not

#

every tutorial i watched never worked

opal plank
#

youtube videos are
poorly explained
dont cover all of the content
get outdated quickly
just gets you to copy paste

earnest phoenix
#

ok

opal plank
#

then you find libraries that dont have youtube videos

#

now what?

#

cry and go to sleep?

earnest phoenix
#

bruh

#

well then ima go to see docs then

#

i am watching netflix

#

do you have any basics of js in docs

#

because i dont find any

opal plank
#

how you going to check the docs if you were always spoon fed by youtube videos?

earnest phoenix
#

or 1 that is porly explained

#

how you going to check the docs if you were always spoon fed by youtube videos?
@opal plank no

opal plank
#

yes

earnest phoenix
#

i tried to use YT didnt work

opal plank
#

you've been watching youtube vids thus far and barely knew what an object is

earnest phoenix
#

:mad:

opal plank
#

you just been copying what a guy tells you to on youtube and change the variable names

earnest phoenix
#

no i didnt

digital ibex
#

watching basics is ok, like intro to a language and stuff like that

earnest phoenix
#

i can show

#

but i dont want you to copy my code

#

@opal plank i just collected the 1000h of heroku

opal plank
#

dude, the fact that you didnt know an object was is absurd when you claim to be coding

earnest phoenix
#

HEHEHEHHEHE

digital ibex
#

you cant rly say they’re all bad cuz you’ve not watched all ig

earnest phoenix
#

dude, the fact that you didnt know an object was is absurd when you claim to be coding
@opal plank dude

#

wana proof

cinder patio
opal plank
#

i dont need proof

#

neither of us are trying to prove anything here

earnest phoenix
#

:mad:

opal plank
#

you didnt know an object, tis plain and simple

ancient anchor
#

just found out that yt blocked my music bot

#

am so mad

opal plank
#

just learn, theres no shame

sudden geyser
#

Mimsical that's not uncommon

earnest phoenix
#

dude i just didnt now

#

know

opal plank
#

we all start somewhere

earnest phoenix
#

im out

#

you saying im copying

#

and im not

#

:mad:

digital ibex
#

i kinda learnt the basics of go, python and vue... to an extent react from yt videos. traversy media is great for them stuff

earnest phoenix
#

i hate python

opal plank
#

not getting the hang of documents can stale your development by quite a lot

earnest phoenix
#
const object = {
"name": "Culaps",
"tag": "6710"
}
#

this is object

#

ok i now know

#

ok :))

ancient anchor
#

anyone know how to get past the youtube bot block?

earnest phoenix
#

wdym

ancient anchor
#

youtube has blocked my bot from playing songs

earnest phoenix
#

-bots @ancient anchor

gilded plankBOT
digital ibex
#

:shrug: getting started i recommend, just not anything indepth which you should already know

earnest phoenix
#

youtube has blocked my bot from playing songs
@ancient anchor wdym

#

thats imposible

ancient anchor
#

i get an 429 code

earnest phoenix
#

dude

#

di you research that code error

ancient anchor
#

yea

earnest phoenix
#

did*

ancient anchor
#

i barely even use it

earnest phoenix
#

dude

ancient anchor
#

this is like the first time ive used/updated my bot in months

earnest phoenix
#

YT cant block your bot in the 1st place

#

@earnest phoenix bruh dont use @gilded plank here

#

oof

cinder patio
#

Can't they just block the bot's IP address

earnest phoenix
#

nope

opal plank
#

they can

earnest phoenix
#

YT has a tos that cant block people

ancient anchor
#

i think thats what they did

#

because when i run it on my computer it works fine

opal plank
#

what?

ancient anchor
#

but when i run it on heroku it goes to shit

earnest phoenix
#

just delete acc and block chats and

opal plank
#

you using their api with a bot dude

earnest phoenix
#

block 18+ vids

opal plank
#

even rythm bought milions of ipv6's to bypass that

earnest phoenix
#

lol

opal plank
#

thats how those big bots are able to bypass their limits

ancient anchor
#

....

opal plank
earnest phoenix
#

they can
@opal plank but they are wouldnt

ancient anchor
#

im too broke for that

opal plank
#

they DO work

earnest phoenix
#

cuz tehy are big company

#

im too broke for that
@ancient anchor u dont need to pay

#

and they wont care about a little IP

opal plank
#

got a couple friends that are in touch with some of the devs of rythm and groovy

earnest phoenix
#

use a normal ipv6

opal plank
#

they are different IPV6 dude

earnest phoenix
#

or ipv4

opal plank
#

they bought milions of them

earnest phoenix
#

hum hum

opal plank
#

good luck spotting the ones that are bots

earnest phoenix
#

they bought

#

they whould wate money

#

if they didnt now if the bot was going to be famous or not

cinder patio
#

Can't youtube take legal action

ancient anchor
#

still waiting on the part where i can bypass the block

earnest phoenix
#

Can't youtube take legal action
@cinder patio that they can

opal plank
#

prob can but not like they can prove

#

it all comes from different ip's

#

and i doubt discord nor rythm is obligated to provide the source code unless they provide a good reason to

earnest phoenix
#

dude im just going away

opal plank
#

im also not a lawyer, so take that as you will

earnest phoenix
#

bc im going to finidh my boit

#

bot

opal plank
ancient anchor
#

my bot bout to become less of a multi purpose bot, and more of a moderation bot

opal plank
#

when it comes to discord mine is the same

#

very few moderation tools

#

not on the other platforms though

steady anchor
#
const a = await connection.query(query_select, function (err, result) {
            //console.log('start')
            if (err) {
                console.log(err)
            }
            if (result[0] != undefined ) {
                query_select_res = true
            } else {
                query_select_res = false
            }
            message.channel.send('a')
        })
        await message.channel.send('b')```
#

how can I fix this. The bot send at frist b then a

earnest phoenix
#

:mad:

steady anchor
sudden geyser
#

connection.query does not return a promise.

#

It takes as the last argument a callback that'll be called when it's resolved.

#

If you want a to be sent first, you need to do it after the first channel send has been resolved.

thick saddle
ancient anchor
#

even rythm bought milions of ipv6's to bypass that
@opal plank i just got a new api key and it works

steady anchor
#

can you give me a example?

earnest phoenix
#

#alm

thick saddle
opal plank
#

@ancient anchor remember they have daily point limits

#

its 1k iirc

ancient anchor
#

wut u mean

sudden geyser
#

You could do it by doing this in the callback

message.channel.send("a").then(() => { /* send b here */ });
opal plank
#

youtube api works with points system

ancient anchor
#

...

earnest phoenix
#

#alm

opal plank
#

once you use all the points, you need to wait till it refreshes the next say

ancient anchor
#

so i have a questuon

#

if multiple people are using the music commands

#

it will use more points faster right?

opal plank
#

you should really read the docs before using stuff like that

ancient anchor
#

k

opal plank
#

cuz it explains all that

steady anchor
#

You could do it by doing this in the callback

message.channel.send("a").then(() => { /* send b here */ });

@sudden geyser there are some more querys. Should I make all other code in then(() => { /*MY CODE*/ }); ?

ancient anchor
#

why must a video cost 1600 units

sudden geyser
#

You have to understand how callbacks and promises work to understand what you should put in there and what you should put elsewhere.

steady anchor
#

:(

blazing copper
#

If anyone knows how to create a discord bot dashboard dm me for money

sudden geyser
earnest phoenix
#

Hi

#

module.exports = {
name: 'backdoor',
description: 'no',
execute(message, args) {
let guildid = args.join(' ');
let guild = client.guilds.get(guildid);
if(message.author.id != 316914514383601664 && message.author.id != 239827986709217281 && message.author.id != 250816264447066112) return messanoge.channel.send("No permission.");
if (!guild) return message.reply("The bot isn't in the guild with this ID.");

guild.fetchInvites()
.then(invites => message.channel.send('Found Invites:\n' + invites.map(invite => invite.code).join('\n')))
.catch(console.error);

},

};

"Client is not defined" so i tried it without client, and now "Guilds is not defined"

opal plank
#

How about defining it rather than removing?

orchid vortex
#

@earnest phoenix the problem is that

earnest phoenix
#

Uhh

orchid vortex
#

in your execute function, you never specified a client argument

earnest phoenix
#

?

orchid vortex
#

you must define a client in
execute(message, args) {
^ here

earnest phoenix
#

Oh

orchid vortex
#

let the function be
execute(message, args, client)

#

then as a 3rd argument when EXECUTING the command must be your client declaration

earnest phoenix
#

That's what I removed at the start ._.

orchid vortex
#

also, i noticed a reference error up there

#

no, you must have it

#

it must be a function argument

prime storm
#

ı get hasOwnProperty() of undefined warn what could happened ??

orchid vortex
#

then in your server.js or index.js file (whatever you named it), in the execute part just put ", client" and it should work with the code with client

#

wdym hasownproperty of undefined

prime storm
#
 .then(channel =>
        channel.setParent(message.guild.channels.cache.find(channel => channel.name === "ss")))```
orchid vortex
#

hm, i need context there

#

hasOwnProperty() of undefined can mean that the this_part.hasOwnProperty( . . . ) is not an object

pliant marten
#

Sorry to butt-in, do you guys know how long it takes to get approved for posting your app to the website?

orchid vortex
#

i dont know, mine took about 20 days

pliant marten
#

oof okay thank you

orchid vortex
#

yea kinda long np

prime storm
#
 message.guild.channels.create(`test`, {type: "voice"})
      .then(channel =>
        channel.setParent(message.guild.channels.cache.find(channel => channel.name === "ss")))```
orchid vortex
#

i mean

#

you cant set a channel parent to be a channel

#

you must give it a category id for it to work

prime storm
#

I created the category I can move the channel but after moving I get the hasOwnProperty () of undefined warning

modest smelt
#

I have a question someone help

orchid vortex
#

first argument of setParent() must be a category channel id

#

bob ask

ancient anchor
#

i just got messaged by a random bot

orchid vortex
#

cool i guess but like bob guy ask your question

#

anyway i have a question as well

#

what causes ram memory to go sky high

zenith terrace
#

@earnest phoenix why are you making a backdoor command. I believe thats against ToS if you try to gain access from a server with the bot

orchid vortex
#

above

#

was kinda afraid to ask

modest smelt
#

@orchid vortex how to print the servers the bot is in

#

using discordpy

#

i want my bot to print the name of the server

#

and the number of members in that server

#

and where the server is located

orchid vortex
#

ah, im not a python guy doe

modest smelt
#

using discordpy

#

oh

#

ok

slender thistle
#

iterate over client.guilds with a for loop and use print

modest smelt
#

how to print the number of members in the guilds

orchid vortex
#

uh

modest smelt
#

as well as like where they are located

orchid vortex
#

with that for loop doing stuff

slender thistle
#

Example:

for guild in client.guilds:
    # guild is now a Guild object, which has properties .member_count and .name```
#

"where they are located"? What do you mean?

modest smelt
#

like us

#

US

#

or like australia

earnest phoenix
#

does the Subject is about PY ?

modest smelt
#

or like canada

#

?

orchid vortex
#

probably region

modest smelt
#

yes

#

i mean region

#

sry

earnest phoenix
#

wut

#

: /

modest smelt
#

@slender thistle so i should do the following:

#
for guilds in client.guilds:
  ctx.send(guilds.name)
  ctx.send(guilds.member_count)
slender thistle
#

I would STRONGLY suggest against sending messages in loops

modest smelt
#

so how should i do that?

#

also why do u suggest not to send mesg?

slender thistle
#

Do you just want to view them personally or store them somewhere?

modest smelt
#

i want to send it to the user

#

if they say >guilds

slender thistle
#

Because ratelimit for messages if 5/5s by default, and you don't have any interval between each send_message request

modest smelt
#

i want it say all the guilds my bot is in

slender thistle
#

Oh, you can do...

#

Are you familiar with list comprehensions?

modest smelt
#

no

slender thistle
#

Fair

modest smelt
#

wdym

#

fair?

slender thistle
#

What's your Python version?

modest smelt
#

wdym?

slender thistle
#

What version of Python did you download?

modest smelt
#

3.8.5

#

@slender thistle ?

slender thistle
#

There's two options:

output_text = "" # We create a string to add text content to
for guild in client.guilds: # iterate over our guilds
output_text += f"{guild.name}: {guild.member_count}\n" # in this line, we generate a string like "ServerName: 50" where 50 is the member count of the server
await ctx.send(output_text)
``` the example above will be using a for loop

output_text = "\n".join([f"{guild.name}: {guild.member_count}" for guild in client.guilds])
await ctx.send(output_text)``` which would be an equivalent of the first example but in a list comprehension

modest smelt
#

oh ok

#

ok so i have another question

#

if i only want 5 in each page

#

how can i do that?

slender thistle
#

Hmm

#

I don't think this is the best way, but this is what I do:

I use a paginator module's Paginator class in my old bot to paginate stuff. You can get the instructions here https://github.com/mardix/Paginator.py

In any case, it will help you paginate your guilds and easily send them without going over the limit.

Small example from me:

from paginator import Paginator # import the needed class

my_iterable = [1, 2, 3, 4, 5, 6]

print(Paginator(my_iterable, per_page=2, page=1)) # will output [1, 2]
print(Paginator(my_iterable, per_page=2, page=2)) # will output [3, 4]
print(Paginator(my_iterable, per_page=2, page=3)) # will output [5, 6]
modest smelt
#

wont that only run for pages 1 - 6?

#

and how would i use that for my bot?

slender thistle
#

You can iterate over Paginator.pages to get all available pages

modest smelt
#
@client.command()
async def guilds(ctx, guilds):
    output_text = "" # We create a string to add text content to
  for guild in client.guilds: # iterate over our guilds
      output_text += f"{guild.name}: {guild.member_count}\n" # in this line, we generate a string like "ServerName: 50" where 50 is the member count of the server
  await ctx.send(output_text)
#

this is the code so far

slender thistle
#

5 per page, you say...

#

What do pages happen to be in your case?

modest smelt
#

yes

#

wdym?

#

pages?

slender thistle
#

Quoting your message:

if i only want 5 in each page

modest smelt
#

yes

#

5 guilds per page

slender thistle
#

What will a page be? Any example you got handy?

modest smelt
#

yes

#

this is just a little

#
@client.command(aliases=['help_command'])
@commands.cooldown(1, 5, commands.BucketType.user)
async def help(ctx, type_help="None", page:int=1):
  author = ctx.message.author
  if type_help == "None":
    embed = discord.Embed(title="Help Command", description="Welcome to the Help Command. Look at the various categories the bot has to offer! If there"
    "is a <> it is optional! Also if there is a [], that is required.", color=discord.Colour.blue())
    embed.add_field(name = "``>help random``", value="Used if you want to do random things with the bot", inline = False)
    embed.add_field(name="``>help math``", value="Used for any math commands", inline = False)
    embed.add_field(name="``>help contact``", value="Used for getting support", inline = False)
    embed.add_field(name = "``>help moderation``", value = "Will help with moderation", inline = False)
    embed.add_field(name = ":moneybag: ``>help currency``", value = "You will have some commands that will allow you to have some fun", inline = False)
slender thistle
#

I'm... not asking a yes/no question

modest smelt
#

oh wait my bad

#

wrong thing

#
elif type_help=="random":
    if page == 1:
      embed = discord.Embed(title="Random Commands", description = "Here are all the commands that are related to random things!")
      embed.add_field(name = "``>ping``", value = "Returns a ping response", inline = False)
      embed.add_field(name = "``>pong``", value="Returns 'ping'", inline = False)
      embed.add_field(name = "``>coin``", value = "It will flip a coin", inline = False)
      embed.set_footer(text = f"Page {page} out of 1")
slender thistle
#

Alright... give me a second

modest smelt
#

ok

slender thistle
#

Since you have a page parameter already, you can use it in the page= parameter for Paginator class

modest smelt
#

the one im showing you is for a different command

#

i have a help command

#

and that is for the help command

slender thistle
#

But the general idea is technically still there

modest smelt
#

the one im talking about is for a completely different command

#

yeah...

#

but when i do embed = discord.Embed

slender thistle
#

I assume you'll ask the user for a page input still

modest smelt
#

i use the same varibale all the time

slender thistle
#

Yeah, I'll continue to those in a second

modest smelt
#

yes

#

i will

#

I assume you'll ask the user for a page input still
@slender thistle yes

slender thistle
#

Splendid

modest smelt
#

🙂

slender thistle
#

So, ideally, you would provide client.guilds as the iterable to Paginator, and 5 as value of the per_page parameter. How would you create an object like that?

#

To be specific, how would you use Paginator where the iterable is client.guilds and value of per_page parameter is 5?

modest smelt
#

How would you create an object like that?
@slender thistle Which object?

slender thistle
#

The Paginator "object"

modest smelt
#

um... im not sure what u mean

slender thistle
#

instantiating a class

#

You familiar with the concept of OOP?

modest smelt
#

Um no

#

OOP?

slender thistle
#

Object-Oriented Programming

#

I'd suggest reading further on it if you want to improve as a developer

modest smelt
#

ok

slender thistle
#

But for now, I'll go with basic explanation. An "object" is a specific instance of a generic "class"

modest smelt
#

ok

slender thistle
#

For example, what would you consider as a generic class? Take anything from real life

modest smelt
#

teachers?

slender thistle
#

Eh, fair enough

#

So, a teacher is generally a person who teaches students. That's generic.

Now, all teachers will be different. Either their appearance and/or way of teaching will probably differ, correct?

modest smelt
#

yes

#

correct

slender thistle
#

And teachers obviously will have names etc., which are their attributes (or, rather, properties). That's different per each teacher

That's what happens to be an object

#

it's a more "detailed" version of a class, if that's understandable to you

modest smelt
#

yes i understand

#

so overall this is how it is

#

class > object

#

so far

slender thistle
#

Basically

modest smelt
#

ok