#development

1 messages · Page 1221 of 1

cunning ore
#

omg

granite echo
#

good

#

now go learn to code

misty sigil
#

you don’t need much knowledge

#

just read through some docs before jumping right in

thick gull
misty sigil
granite echo
#

😔

cunning ore
#

i know how create Bot for ban , Kick,and welcome and Music But i dont know the Music on visual i need someone to give me the commands for music

#

for Visual

granite echo
#

mate

#

no one will spoonfee

#

d

#

go learn to code

misty sigil
granite echo
#

u got the resource up there

earnest phoenix
#

you didn't create them, you did a frankenstein on a bunch of github and SO code

misty sigil
#

lmfao thanks cry

cunning ore
#

no

#

1

#

2

#

3

pale vessel
#

yikes

misty sigil
earnest phoenix
#

yeah of course

granite echo
#

making a bot is fun, but also brings responsibility because when it breaks u need to know how to fix it, learn the basic fundamentals of the lang ur using

earnest phoenix
#

good job, it's entirely accurate @misty sigil

misty sigil
#

idk what you want by that

granite echo
#

wdym

misty sigil
#

good job, it's entirely accurate @misty sigil
@earnest phoenix thanks.

pale vessel
#

you can't kick a user

granite echo
#

lol what

misty sigil
#

ah yes thank you flazepineapple

#

it must be a member

granite echo
#

you know what i mean

pale vessel
#

and for it to be a member it must be in the guild

misty sigil
#

message.guild.members.cache.get()?

granite echo
#

im trying to kick a bot

#

when it gets denied

misty sigil
#

You need member

#

not user.

granite echo
#

ah, thxs

#

i asked a question here around 2-3 hours ago, but how do u add a role to only bots when they join

earnest phoenix
#

i need help!

granite echo
misty sigil
#

i asked a question here around 2-3 hours ago, but how do u add a role to only bots when they join
@granite echo guildMemberAdd event

earnest phoenix
#

I am working with sqlite3, and I would like to know how I can store the data (jobs, coins etc) by servers

granite echo
#

ye, but i only want it to be a bot

misty sigil
#

then <member>.user.bot returns if the member is bot

granite echo
#

ah

misty sigil
#

does that awnser it?

earnest phoenix
#

I am working with sqlite3, and I would like to know how I can store the data (jobs, coins etc) by servers
@earnest phoenix pretty sure you can't

granite echo
#

ye ty

misty sigil
#

you probably can

earnest phoenix
#

just have a primary key thats set to the guild id

cinder patio
#

of course you can, loo

earnest phoenix
#

wtf

#

@earnest phoenix pretty sure you can't
@earnest phoenix and how i show a laderbAnd how I show a leaderboard of the members of a server

#

leaderboard*

#

we dunno how your code works

#

you need to figure it out on your own

#

well

thick gull
#

you didn't create them, you did a frankenstein on a bunch of github and SO code
@earnest phoenix no he didnt create it he just downloaded JMusicBot

granite echo
#

really silly question

#

does this work

#
client.on("guildMemberAdd", member => {
    client.roles.cache.get('752135362947842140').add().member.user.bot
})
misty sigil
#

No

granite echo
#

hhhhhh

misty sigil
#

if(member.user.bot)

granite echo
#

o ffs how can be that stupid

#

ty

knotty steeple
#

@earnest phoenix get the first x amount of rows

#

🧠

#

DESC LIMIT x

granite echo
#
client.on("guildMemberAdd", member => {
    if(member.user.bot) return
    client.roles.cache.get('752135362947842140').add()
})

yes?, sorry i ask alot i like to make sure i do it right

misty sigil
#

no

sand condor
misty sigil
#

that adds it if the member isn’t a bot

sand condor
#

client.roles isn't a thing

misty sigil
#

wait fuck

#

good catch

#

member.roles.add()

granite echo
#

ew docs, i will never in my life read docs, i am self taught and always will be,

sand condor
#

your code doesn't look like it's fine

thick gull
#

have fun

sand condor
#

it's totally wrong

thick gull
#

docs is how you self learn then

#

kekw

quartz kindle
#

Reading docs is precisely what self taught people do

granite echo
#

not me

#

i learn by doing

#

not reading

quartz kindle
#

You have to do both

granite echo
#

nope

sand condor
#

well no one is going to spoonfeed you to the code

quartz kindle
#

Otherwise youll have a hard time

granite echo
#

i dont want spoonfeeding

#

lmao

thick gull
#

docs are not spoonfeeding

sand condor
#

do you want your code to work

quartz kindle
#

Anyway docs is something that will grow on you

thick gull
#

it is telling you what's in in the language/library

#

??

quartz kindle
#

You may not read them now but eventually you will learn and enjoy reading them

granite echo
#

nice

dreamy thistle
#

is there anyway to detect all the members in a voice channel?

sand condor
#

library ?

granite echo
#

i doubt that tim, im a round a month self taught

sand condor
#

have fun

quartz kindle
#

I started reading docs more seriously after like a year

misty sigil
#

I just read docs

#

for fun

granite echo
#

ill only read docs if im extremely stuck

thick gull
#

you can not use docs, but like

#

alot of simple things are in there

#

like message.author.bot

granite echo
#

nic

#

e

sand condor
#

and like adding a role to a member

granite echo
#

nic3

#

e

sand condor
#

and like client.roles isn't a thing

granite echo
quartz kindle
#

How do you use a random npm library without reading how to use it?

thick gull
#

you guess

granite echo
#

cool no need to repeat ur self

#

ill read npm info but not docs

sand condor
#

???

quartz kindle
#

That is the same as docs lol

granite echo
#

nit really

thick gull
#

yes

granite echo
#

o*

thick gull
#

that is docs

sand condor
#

how old r u

granite echo
#

old enough

misty sigil
#

if(member.user.bot)do shit here

quartz kindle
#

Anything that explains how to use it its docs

sand condor
#

doesn't seem like it

granite echo
#

nice

peak quartz
#

This really just seems like low quality bait

sand condor
#

true

earnest phoenix
#

as old as time

#

-15482746 years

#

<The hell is going on here>

#

So 0

granite echo
#

ima put this out there, idc if u help, ill just do it the old way, but that is entirely up to you, i will never in my life i swear on gods words bait someone, but ya'know, thats up to you to believe

sand condor
#

ok

misty sigil
#

if(member.user.bot)member.roles.add("roleID") that simple

#

AE

sand condor
#

why, giving out code isn't going to help them learn

granite echo
#

ew spoonfeed

#

ima go rinse my eyes

winter topaz
#

yikes

thick gull
#

yikes

granite echo
#

@winter topaz stop following me

#

lol

winter topaz
#

lmfao

drifting wedge
#

how do i style my bot page?

sand condor
#

css

earnest phoenix
#

i-

granite echo
earnest phoenix
#

I told you that like 1k times before

granite echo
#

@drifting wedge ^

sand condor
#

so you can link docs for other people but can't read them yourself ?

misty sigil
#

huh that’s

granite echo
#

how about u stop trying to cause shit

sand condor
#

just asking

jaunty lichen
#

I know CSS, but where to do that?

misty sigil
#

how about you read docs

#

I know CSS, but where to do that?
@jaunty lichen you can use style tags in the long description

earnest phoenix
#

@granite echo You're trying to say this

I'm self thought
I don't read docs because i want to be spoon fed to go through it
Ew spoonfeed?

jaunty lichen
#

@misty sigil Ah Thank you!

earnest phoenix
#

What in the gods name

misty sigil
#

no problem

#

What in the gods name
@earnest phoenix also making a bot list

#

without reading docs

wicked pivot
#
let embed = new MessageEmbed()
     .setTitle('Utilisateur a bien été banni')
     .setDescription`> > **Utilisateur banni :**
     > Name :
     ${member.user.tag}
     > ID : 
     ${member.user.id}
     > Raison du ban :
     > ${reason}
     
     > > **Utilisateur qui a executer**
     > Name : 
     ${message.author.tag}
     > ID : 
     ${message.author.id}`
     .setFooter(`demande de ${message.author.username}`, message.guild.iconURL({dynamic: true}))
     .setColor(`#dc143c`)
     .setTimestamp();

  await member.ban({reason : reason + ` (${message.author.tag})`})
  return await message.channel.send({ embed: embed })```what ?
misty sigil
earnest phoenix
#

Well that's...

misty sigil
#

with quick.db too

granite echo
#

wrong

misty sigil
#

oh nice

granite echo
#

not quick db

misty sigil
#

what db?

thick gull
#

sqlite then

sand condor
#

keyv

granite echo
#

simple-json-db

#

nope

sand condor
#

LOL

thick gull
#

j s o n

misty sigil
#

JSON DB

thick gull
earnest phoenix
#

@wicked pivot Bruh?

granite echo
#

for now

thick gull
#

bot list => json db

earnest phoenix
#

Heard of methods?

misty sigil
#

I’m gonna cry of laughter

granite echo
#

now ima get back to coding

sand condor
#

json db is the best db tbh

misty sigil
#

JSON isn’t a database

thick gull
#

already better tahn dbl's ram db

misty sigil
earnest phoenix
#

Json is only used to store small amount of info

granite echo
earnest phoenix
#

Prone to corruption

misty sigil
#

JSON cry

#

WHY

thick gull
#

json is decent for static data

misty sigil
#

your bot list will be fucked

thick gull
#

not databases

#

your bot list will be fucked
@misty sigil if you dont read docs it'll be fucked even with a json db

earnest phoenix
sand condor
#

json db is so good stop hating

earnest phoenix
#

You know that's a method too

thick gull
#

i cannot tell if you are being sarcastic @sand condor

sand condor
#

i can't either

peak quartz
earnest phoenix
#

First ever bot I made used a json db

#

Never

#

Again

misty sigil
#

I never used json db

wicked pivot
#

@earnest phoenix ahhhh sorry ..

thick gull
#

i only took the bit to read a json file cause i didnt realize you could just do require("")

earnest phoenix
#

Corrupted 2 days later

misty sigil
#

lol

earnest phoenix
#

In 4 servers 🧑🏻‍🦯

#

Use json db
Thinking it's the best and works for a few days
Corrupted in 3 days

#

Now I switched to MySQL databases and APIs made from php, it’s now in 4K servers 😄

thick gull
#
let embed = new MessageEmbed()
     .setTitle('Utilisateur a bien été banni')
     .setDescription`> > **Utilisateur banni :**
     > Name :
     ${member.user.tag}
     > ID : 
     ${member.user.id}
     > Raison du ban :
     > ${reason}
     
     > > **Utilisateur qui a executer**
     > Name : 
     ${message.author.tag}
     > ID : 
     ${message.author.id}`
     .setFooter(`demande de ${message.author.username}`, message.guild.iconURL({dynamic: true}))
     .setColor(`#dc143c`)
     .setTimestamp();

  await member.ban({reason : reason + ` (${message.author.tag})`})
  return await message.channel.send({ embed: embed })```what ?

@wicked pivot

is message.author a thing (?)

earnest phoenix
#

Of course it's

#

Yes?

thick gull
#

no i mean

#

defined

#

they could have msg

#

and not message

earnest phoenix
#

No i fixed his problem

thick gull
#

oh

#

okay

wicked pivot
#

@thick gull it's settled it's settled

thick gull
earnest phoenix
#

Bruh Momento

wicked pivot
earnest phoenix
#

@wicked pivot Use the find() method on the collection not the filter() method

drifting wedge
#

how do i editt the bot page

#

not the html description

urban olive
#

need help with an error

#
        {
            NoLevelGuilds = NoLevelGuilds.replace(message.guild.id, "gone");
            jsonfile.writeFileSync('NoLevelGuilds.json', NoLevelGuilds);
            message.channel.send('Leveling is now on for this guild')
        } ```
woven sundial
urban olive
#

it says TypeError: NoLevelGuilds.replace is not a function

granite echo
#

bro

#

npm i <packageName>

earnest phoenix
#

@woven sundial It wasn't able to make a folder named .staging

#

@granite echo No

woven sundial
#

Its for installing packages from a package.json

granite echo
#

@earnest phoenix k

earnest phoenix
#

Does your node_modules folder already has a folder called .staging? @woven sundial

woven sundial
#

no

#

its is empty

earnest phoenix
#

So there's one?

woven sundial
#

nope

earnest phoenix
woven sundial
urban olive
#
        {
            NoLevelGuilds = NoLevelGuilds.replace(message.guild.id, "gone");
            jsonfile.writeFileSync('NoLevelGuilds.json', NoLevelGuilds);
            message.channel.send('Leveling is now on for this guild')
        } ```

`TypeError: NoLevelGuilds.replace is not a function`

help?
earnest phoenix
#

Have you tried npm rebuild? @woven sundial

#

@urban olive noLevelGuilds is not a string

#

replace() is only available to use on a string

wicked pivot
#

how do you get back the custom status in v12?

earnest phoenix
#

You can't set a custom status to bots

woven sundial
#

I did your command but it didn't changed anything when I try to npm i

earnest phoenix
#

Hmm, that's strange

wicked pivot
#

retrieve that of a user *

earnest phoenix
#

Oh

urban olive
#

but i want to replace a specific guildID within the variable with "gone"

wicked pivot
#

before I used to do that

if(!user.presence.game){
        var GameName = "n'a pas de jeux"
    }else if(user.presence.game.name === "Custom Status"){
        var GameName = user.presence.game.state
    }else if(user.presence.game.name !== "Custom Status"){
        var GameName = user.presence.game.name
    }```
earnest phoenix
#
<User>.presence.activities.find(a => a.type === "CUSTOM_STATUS")``` @wicked pivot
#

@urban olive What's noLevelGuilds defined as?

urban olive
#

a var

earnest phoenix
#

What's that var's value

#

I meant

urban olive
#

it holds the guild IDs of servers that have disabled leveling with my bot

woven sundial
#

hmm Voltrex it seems to be an error on my external disk

earnest phoenix
#

I meant is it a object? array? string? boolean? @urban olive

#

@woven sundial Maybe

woven sundial
#

maybe an error permission ?

urban olive
#

object

earnest phoenix
#

@woven sundial Try with root? I mean sudo

woven sundial
#

I was already in sudo

earnest phoenix
#

Hmm

woven sundial
#

ty for helping anyways 🙂

urban olive
#

{"750072798050779136":{},"653568812578373643":{}}
here is whats in noLevelGuilds.json

#

i want to get one guild id out of it

earnest phoenix
#
if (message.guild.id in NoLevelGuilds) {

NoLevelGuilds[message.guild.id] = "gone";
            jsonfile.writeFileSync('NoLevelGuilds.json', NoLevelGuilds);
            message.channel.send('Leveling is now on for this guild');
        }```
#

@urban olive try this

drifting wedge
#

instead of using pixels

#

can i center something?

#

like a text on an image when using PIL?

urban olive
#

ok letme see

misty sigil
#

using json as dynamic data storage

earnest phoenix
#

Big L

urban olive
#

doesn't give me an error but it changes nothing

#

letme try something

earnest phoenix
#

Try again

#

I edited what i sent

#

@urban olive

urban olive
#

{"750072798050779136":"gone","653568812578373643":{}}

#

i want the guild id replaced with "gone"

misty sigil
#

just delete that entry?

urban olive
#

yes

misty sigil
#

oh it’s not mongo

urban olive
#

trying to get rid of a guild id

#

trying to get rid of 750072798050779136 from the file

misty sigil
#

idk I don’t use json “databases”

earnest phoenix
#

I know how to do that but if you try to do that to also other guilds in the json, it would screw up

#

result = noLevelGuilds.json result[guild.id]

#

@urban olive For example try this

if (message.guild.id in NoLevelGuilds) {

delete NoLevelGuilds[message.guild.id];
            jsonfile.writeFileSync('NoLevelGuilds.json', NoLevelGuilds);
            message.channel.send('Leveling is now on for this guild');
        }```
#

This doesn't change their name to gone but completely deletes them

#

Which is better

misty sigil
#

ok dice lemme guess

pure lion
misty sigil
#

addedBots doesn’t show up as you have no queued bots

pure lion
#

yes

urban olive
#

yea it works

#

thanks!

earnest phoenix
#

Np

pure lion
#

and the orror message doesnt show up

#

any ideas vx?

earnest phoenix
#

H m m

pure lion
#

:(

earnest phoenix
#
addedBotsOnQueue ? addedBotsOnQueue : "You have no queued bots"```
pure lion
#

epic

misty sigil
#

ok so imma construct something

earnest phoenix
#

@pure lion Did it work?

pure lion
#

uh

#

no

#

i think i fucked everything up uwu

earnest phoenix
#

Lol

drifting wedge
#

How do I chang the background on my bot page,?

heavy anchor
#

How do I chang the background on my bot page,?
@drifting wedge With CSS

drifting wedge
#

Not the text bot

#

Box

#

The actual background

heavy anchor
#

Yes like I said with CSS

drifting wedge
#

How?

heavy anchor
pure lion
#

:ccccccccc

#

ffs

sudden geyser
#

[Rust] I already know some Rust, but re-reading the book to gain more knowledge. I've modified the example which features slicing: ```rust
fn first_word(word: &String) -> &str {
for (index, char) in word.char_indices() {
if char == ' ' {
return &word[..index];
}
}

&word

}

fn main() {
println!("{}", first_word(&"Abyss".to_string()))
}```
What confuses me is the return type. &&String is the result of &word at bottom (&str for the early return). How is &&String equal to &str?

tidal marlin
#

How do I save an object to a json file?

earnest phoenix
#

fs exists

#

For a reason, js fs.writeFileSync(<file name as the first parameter>, <content to write in as the second parameter>)

pure lion
#

json.stringify it

tidal marlin
#

I see

#

So I will make a string of it

earnest phoenix
#

No

misty sigil
#

JSON "databases" and why you shouldn't use them

  1. You are writing/reading to and from a file, which if not done correctly (including safety checks) can lead to data loss/corruption
    a. regular databases have a lot of safety features to prevent and auto-repair corruption, while JSON has none, they also usually have something to roll back to in case of data loss
  2. The file will get larger and larger, and while databases can edit small parts of it at a time, JSON can only edit the full file at once, meaning the entire file has to be rewritten to change a small piece of data, which makes it extremely slow for large files
  3. The syntax is too strongly typed, one character wrong and your database is gone
  4. JSON "databases" are way less scalable than even quick.db, and quick.db is arguably easier
    Woah! You’ve went ahead a bit, what even is JSON in the first place
    JSON stands for Javascript Object Notation,
    JSON is
    • a lightweight format for storing and transporting data
    • often used when data is sent from a server to a web page
    • "self-describing" and easy to understand
    Where can JSON be used though?
    JSON can be used to store data that isn't changing often (e.g a simple config file)
{
"token":"token",
"prefix":"!"
}``` 
— **It may just be a bad practice**
While it may not be the end of the world, put yourself in this scenario 
```css
Bob: I just got my bot approved on top.gg, and I am gaining so many servers!
Billy: What DB do you use?
Bob: I use json as a database
Billy: But you know that will eventually corrupt, right?
Bob: Yea, but I do not know any different ways of doing it.
Billy: Come back when everything is broken and corrupted
* 3 days later *
Bob: You were right, I cannot use a json database forever 😢
Billy: Thats why everyone in #development told you to use something other than json  

Also see: #development message
jsondbbad

earnest phoenix
#

Holy s h i t

misty sigil
#

shit wrong channel

pure lion
#

no right channel

earnest phoenix
#

L o l

misty sigil
#

but ill keep it here because its useful probably

earnest phoenix
#

That's the b i g g e s t wall of truthness i have ever seen

drifting wedge
#

how do i center text in an image

#

using PUIL

sudden geyser
#

Database file(s) can also corrupt, but they're more resistant and/or have something to roll back to.

misty sigil
#

@sudden geyser thanks i'll add that

earnest phoenix
#

Database file(s) can also corrupt, but they're more resistant and/or have something to roll back to.
@sudden geyser Actually, any file can be corrupted if you know how to corrupt them

sudden geyser
#

Yeah I know

#

Database files have their special flavor in it

#

To be honest I don't think using JSON as a DB is the end of the world. It's just bad practice.

misty sigil
#

thats why its the end of the world

#

say if your bot grows

pure lion
#

what the fuck was i about to do

earnest phoenix
#

Bad practices are always the end of the world

misty sigil
#

then you don't know how to use anything other than JSON

earnest phoenix
#

Now trying to understand how databases work other than using json database and hurting your Brain is a pain

#

In this situation

heavy anchor
#

even quick.db would be a better option...

earnest phoenix
#

Lets say this, if your bot is on DBL and you expect it to grow. You should abandon json right now. As it wont be able to handle it if your bot grows a ton.

#

But, if you don't expect much growth then you are fine to stick with json

pure lion
#

isnt mongodb just json with extra steps pogey

earnest phoenix
#

Essentially yes, but lets keep this formal please.

#

<MongoDB won't get corrupted>

#

Or at least any time soon

pure lion
#

lol

earnest phoenix
#

quick.db would be a better option than just casual json. But isn't much of an upgrade due to the lack of sharding support. so, if I was you. I'd jump to mongo or postgres as soon as you can. Mongo has a free hosted version which you are able to use, and it works great. I use it myself on a few bots.

#

Yea in mongodb you can choose a free plan that gives you a free cluster, but it isn't too big of a deal since it doesn't have a big memory size

sudden geyser
#

If the bot grows of course the issues will catch up to you. However, if I'm hosting a small bot that's (for example) is in a few servers and I don't have much plans on making it scale I probably don't care too much about it. You can use JSON in a dumb way and get corruption on day one.

And if the programmer doesn't want to use SQL directly, they can use an ORM or whatever high-level API for managing their database. I think some people here are just quick to point the finger at everyone saying, "No, bad. Do this instead."

earnest phoenix
#

But you can choose to upgrade the cluster

pure lion
#

you can also download mongodb community

sudden geyser
#

For the most part I use SQL with SQLite.

earnest phoenix
#

You can host your own mongodb if you wanna, but the free one is more than enough for most bots

#

unless its an economy bot. in that case I'd suggest hosting your own version

pure lion
#

and the entirety of dbl?

#

im curious as to how much it takes up

misty sigil
#

ok

#

there we go i think im done

earnest phoenix
#

You aren't gonna store the entire data of the dbl are you

#

lets see here. lemme log into my mongo compass

heavy anchor
#

lol

pure lion
#

"5 mb"

misty sigil
#

infact, just the entire message

earnest phoenix
#

well, lets say this. 4.3 million documents in mongo at a average size of 217B is using 893MB

misty sigil
#

only that much

#

fucking hell

earnest phoenix
#

yeah

#

its pretty nice

pure lion
#

mattt, to be honest it makes sense

earnest phoenix
#

granted we dont store much

misty sigil
#

so whats ur opinions

pure lion
#

is nice

misty sigil
#

thanks dice

earnest phoenix
#

It's nice

misty sigil
#

thanks

pure lion
#

maybe provide alternatives?

misty sigil
#

argh matey

#

that'll take up too much characters

#

WAIT I KNOW WHAT TO DO

pure lion
#

:o

earnest phoenix
#

@misty sigil Also you can say, like you can use quick.db in the beginning

#

Or switch to mongo instead

pure lion
#

provide src^^

misty sigil
#

done

#

oh ffs i have to provide src

pure lion
#

would be wise

earnest phoenix
#
${body1.data.map(body1 => body1["252490"].data.categories.description)}

TypeError: Cannot read property 'map' of undefined

#

I like it mr clarkson

misty sigil
#

thanks

pure lion
#

mine wasnt pinned 😧

earnest phoenix
#

@earnest phoenix What's body1?

pure lion
#

assuming this one is pinned too

earnest phoenix
#
fetch(oyunbilgisi).then(results => results.json()).then(body1 => {
          if(body1.success === false) return message.channel.send(`**${message.author.tag}**: Oyun bulunamadı.`);
misty sigil
#

lmao i dont expect a pin

#

just a few uses here'n'there

drifting wedge
#

how can i center messages in PIL?

summer torrent
#

@earnest phoenix console.log() body1 and see it's values

misty sigil
#

after all, one is enough

#

just slimming it down now

earnest phoenix
summer torrent
#

data is in 252490

#

just do body1["252490"].data

earnest phoenix
#

${body1["252490"].data.map(body1 => body1["252490"].data.categories.description)}`,false)

#

yeah yeah

#

benim hatam 😄

#

sorry.

summer torrent
earnest phoenix
#

TypeError: body1.252490.data.map is not a function

#

hmm

summer torrent
#

data is Object

#

not Array

drifting wedge
#

how can i center messages in PIL?

summer torrent
#

pil?

obtuse jolt
#

how do i get the info of uncached users?

summer torrent
#

in discord.js?

obtuse jolt
#

yes

misty sigil
#

u have to fetch them

summer torrent
#

use force option on fetch()

obtuse jolt
#

how do i do that

misty sigil
#

<Client>.users.fetch()

#

returns a promise

summer torrent
#

fetch('something', true)

#

true is for skipping cache

drifting wedge
#

how can i center messages in PIL?

charred geyser
#

anyone help me out with this?

#

got a schema that im trying to use

#

monogodb

#
const { Schema, model } = require("mongoose");

const guildSettingSchema = new Schema({
  guildName: { type: String },
  guildID: { type: String },
  prefix: { type: String, default: "%" },
  autoRole: { type: String },
  joinMessage: { type: String },
  leaveMessage: { type: String }
});

module.exports = model("guild_settings", guildSettingSchema);
obtuse jolt
#

for verification levels dfoes it use NONE if its set to none?

#

or something else

ionic dawn
charred geyser
#

oh wait i think im retarded

drifting wedge
#

@slender thistle

#

u know how i can center images in pil?

charred geyser
#

bruh

drifting wedge
#

sprry

#

Text

#

not imahes

#

and this is what i get back
@charred geyser this mongo?

charred geyser
#

so my schema is this:

const { Schema, model } = require("mongoose");

const guildSettingSchema = new Schema({
  guildName: { type: String },
  guildID: { type: String },
  prefix: { type: String, default: "%" },
  autoRole: { type: String },
  joinMessage: { type: String },
  leaveMessage: { type: String }
});

module.exports = model("guild_settings", guildSettingSchema);

and on message event i have it check if there is data that already exists for the server and if it doesn't it will create a new set which should be:

            const newGuild = new Guild({
                _id: mongoose.Types.ObjectId(),
                guildID: message.guild.id,
                guildName: message.guild.name,
                prefix: process.env.PREFIX,
                autoRole: "null",
                joinMessage: "null",
                leaveMessage: "null"
            })

but all i get back is:

#

yeah its mongodb

drifting wedge
#

ah

#

im doing welcome cards

#

but i need to center text

charred geyser
#

im trying to do auto role

granite echo
#

ok now im truly stuck
https://voidbin.cc/paste/ajSkcz#
There was an error trying to execute that command because of TypeError: Cannot read property 'id' of undefined

charred geyser
#

what line

granite echo
#

the only line with "id" in it

charred geyser
granite echo
#

yep

#

ik it works becuase it is out of my eval command

earnest phoenix
#

how can I search the json file by name?

granite echo
#

wdym

#

@charred geyser well ?

charred geyser
#

what

granite echo
#

lol u were helpin me

charred geyser
#

i was?

granite echo
#

yep

charred geyser
#

i need help myself kekwlaugh

granite echo
#

lol

#

ok

digital ibex
#

that code bin doesn’t work on mobile, @granite echo

charred geyser
#

rip

granite echo
#

it should

#

i jus used it

digital ibex
#

doesnt let me scroll down

granite echo
#

ooooof

digital ibex
#

just send the line which is erroring

granite echo
digital ibex
#

what line?

granite echo
#

its pretty simple once u read my error

drifting wedge
#

how can i center text in PIL?

digital ibex
#

sorry, but i cant be bothered to look through 50 lines of code

charred geyser
drifting wedge
#

PLEASE

granite echo
#

lmfao

charred geyser
#

line 9

granite echo
#

its the only line mate

viral spade
#

Does any of you know discordeno? Can you recommend it?

charred geyser
#

@granite echo just be straight up

granite echo
#

no need to

charred geyser
#

people dont have to help you

granite echo
#

its right there

#

nice not asking u to am i

#

frankly, idc if u do

charred geyser
#

ok

earnest phoenix
#

noobs

charred geyser
#

what

digital ibex
#

ur moms fat

charred geyser
#

rip

#

she actually is

#

it really pisses me off

digital ibex
#

i was talking to hunte-

charred geyser
#

oh

#

lol

final token
#

what should i add to my bot

#

i have 141 commands rn

digital ibex
#

ping command

final token
#

thats the first command i made

charred geyser
#

what sort of bot is it

digital ibex
#

hello command

charred geyser
#

ghostybot

final token
#

hello command is uselless

digital ibex
#

u say hello to it and it says hi back

#

no its not

#

someone could be depressed! u cured someones depression!!

earnest phoenix
#

a ton of commands does not mean quality

final token
#

it is to me lol

digital ibex
#

wow

earnest phoenix
#

clean up your current code

digital ibex
#

rude!

charred geyser
#

is it weird that i enjoy cleaning up code

final token
#

idk

digital ibex
#

nah

#

i enjoy it too

final token
#

but i wanna move my bot to lavalink for music instead of ytdl and ffmpeg

charred geyser
#

its so satisfying having everything organised and looking nice

earnest phoenix
#

lavalink is trash

misty sigil
#

agree

final token
#

its been pretty damn good for me in the past

#

for d.js v11

misty sigil
#

d.js 11

digital ibex
#

but i dont really do it much since im not working on any actual projects anymore, only small ones to help with learning python and js

earnest phoenix
#

only useful for people who don't know how to utilize ffmpeg and pipe content

final token
#

idk what to do for d.js v12 lavalink

charred geyser
#

can anyone have a look at my thing now

final token
#

ima get a shower then rewrite my music commands

#

cya

drifting wedge
#

how do i make text centred?

#

im using PIL

charred geyser
#

py?

drifting wedge
#

yea

#

its for welcome cards

#

and it works fie

charred geyser
#

i dont know py

#

sorry

drifting wedge
#

but the text isnt centred

earnest phoenix
digital ibex
#

@charred geyser show ur message event where ur updating the doc

obtuse jolt
#

how do i get the create date of an uncached users account

digital ibex
#

what language?

obtuse jolt
#

js

digital ibex
#

library?

charred geyser
#
 if (message.author.bot) return;

    const settings = await Guild.findOne({
        guildID: message.guild.id
    }, (err, guild) => {
        if (err) console.error(err)
        if (!guild) {
            const newGuild = new Guild({
                _id: mongoose.Types.ObjectId(),
                guildID: message.guild.id,
                guildName: message.guild.name,
                prefix: process.env.PREFIX,
                autoRole: "null",
                joinMessage: "null",
                leaveMessage: "null"
            })

            newGuild.save()
            .then(result => console.log(result))
            .catch(err => console.error(err));

            return message.channel.send('This server was not in my database! I have now added and you should be able to use bot commands.').then(m => m.delete({timeout: 10000}));
        }
    });
#

thats whats in message.js event @digital ibex

#

well the rest is just dealing with commands

#

that is the relevant content

digital ibex
#

remove the const newGuild = ... and change that to settings =

#

and make settings a let, not const

#

and newGuild.save() = settings.save()

charred geyser
#

to settings =

#

ok ill try that

digital ibex
#

yeah

#

anywhere u have newGuild, change it to settings

earnest phoenix
#

how do i get all values in an object?
ex: body.data.genres

digital ibex
#

uh, body.data.genres ?

earnest phoenix
#

I want to get all the descriptions in this section

charred geyser
#

@digital ibex :3

#

tyty god

digital ibex
#

does it work?

charred geyser
#

yea

digital ibex
#

noice

charred geyser
#

im just setting that up

#

so

#

they will be "null" by default

#

and people can set them in my dashboard

#

idk if i should also add a command to set them

#

i kinda wanna get people to use the dashboard more

digital ibex
#

@earnest phoenix u need to provide more context

earnest phoenix
#

for example ${body1.map(body1 => body1.name)} returns arrays.

digital ibex
#

yeah?

earnest phoenix
#

object instead of array

digital ibex
#

use Object.assign

charred geyser
#

@digital ibex with that new data in the db could i then do something like

    let role = guild.roles.cache.find(role => role.name === settings.autoRole);
    member.addRole()
earnest phoenix
digital ibex
#

example: Object.assign({}, [“bob”, “bob”])

misty sigil
#

bob

digital ibex
#

yeah, @charred geyser

charred geyser
#

nice

drifting wedge
#

hello

#

can anyone pls help

digital ibex
#

idk about the member.addrole bit, but it seems right to me

drifting wedge
#

using pil how can i center text on an imahe:

charred geyser
#

it might have to be member.addRole(role)

#

or something

#

iim not sure

#

ill look it up

misty sigil
#

member.roles.add()?

charred geyser
#

how does one specify the role?

digital ibex
#

@earnest phoenix have an array with objects inside, and map through all of them and then the Object.assign bit

misty sigil
#

you can use just ID

charred geyser
#

but considering the codeblock

#

let role = guild.roles.cache.find(role => role.name === settings.autoRole);

#

would that give an id?

digital ibex
#

it returns an object

#

so u can then do, member.addRole(role.id)

charred geyser
#

oh yeah right

#

ok

#

thats fine

#

ill test it

misty sigil
#

It works with role objects too

charred geyser
#

just role?

#

like member.addRole(role)

#

or just member.addRole()

#

rip

digital ibex
#

discord.js is weird sometimes...

charred geyser
#

TypeError: Cannot read property 'autoRole' of null

digital ibex
#

i wonder how they parse that to do that.. 🤔

charred geyser
#

this is the way it is defining settings

#

const settings = await Guild.findOne({
guildID: guild.id
});

#

and then the role gets settings.autoRole

digital ibex
#

the guild doesnt exist in the collection

charred geyser
#

yeah it should

digital ibex
#

console.log(settings)

charred geyser
#

null

#

isn't that what i want tho

#

thats what i set it to

digital ibex
#

no

charred geyser
#

in the db

#

let me change it in the database and see if it logs something else

digital ibex
#

show the message event, the stuff related to the db again

#

the updated code

charred geyser
#

uhh

#

ok

#

    let settings = await Guild.findOne({
        guildID: message.guild.id
    }, (err, guild) => {
        if (err) console.error(err)
        if (!guild) {
            const settings = new Guild({
                _id: mongoose.Types.ObjectId(),
                guildID: message.guild.id,
                guildName: message.guild.name,
                prefix: process.env.PREFIX,
                autoRole: "null",
                joinMessage: "null",
                leaveMessage: "null"
            })

            settings.save()
            .then(result => console.log(result))
            .catch(err => console.error(err));

            return message.channel.send('This server was not in my database! I have now added and you should be able to use bot commands.').then(m => m.delete({timeout: 10000}));
        }
    });
digital ibex
#

why are you reassigning settings?

charred geyser
#

if the guild doesn't exist in the db

digital ibex
#

remove the const

charred geyser
#

it needs to add it

digital ibex
#

wait no, mb

#

u are connecting to the db, right?

charred geyser
#

yeah

#

the info updates

#

like

#

the bot and the dashboard both update the prefix

#

in the db

digital ibex
#

what is Guild ?

#

const settings = await Guild.findOne({
guildID: guild.id
});
that Guild

charred geyser
#

const Guild = require('../models/guild');

#

the schema

drifting wedge
#

anyone know pul:

digital ibex
#

just ask ur question

obtuse jolt
#

how can i get the actual ammount of users of a guild

sudden geyser
#

<Guild>.memberCount?

digital ibex
#

ok better

charred geyser
#

idk if it applies but to get the total number of users my bot is used by is client.users.cache.size

sudden geyser
#

That applies to the total number of users your client has cached.

charred geyser
#

yea

drifting wedge
#

can anyone please fricking help me:

#

its with python

#

and PIL

#

PLEASE lol

solemn latch
#

Freaking did you ask

digital ibex
#

how do u expect someone to help you if u dont ask ur question

drifting wedge
#

i did

#

ok

solemn latch
#

Can you link to it

drifting wedge
#

how do i center text in PIL

solemn latch
#

🤔

digital ibex
#

i’ve asked u a few times to ask ur question

#

ok

charred geyser
#

like this?

drifting wedge
#

not center in the middle, but like in a area

charred geyser
#

draw.text(((MAX_W - w) / 2, (MAX_H - h) / 2),astr,(255,255,255),font=font,align="center")

drifting wedge
#

im doing welcome cards

solemn latch
drifting wedge
#

draw.text(((MAX_W - w) / 2, (MAX_H - h) / 2),astr,(255,255,255),font=font,align="center")
@charred geyser center of image tho

charred geyser
#

align="center"

drifting wedge
#

i found all of these

#

but its like center of a specific area

#

like bottom middle

#

this is it

#

it works

#

but its a bit off

digital ibex
#

change the dimensions?

drifting wedge
#

well i did

#

the thing is, itll be customisable

#

so i just need to figure out how to get it centred in the bottom

digital ibex
#

im assuming the 255s is the height, length and width

#

change the 2nd 255 maybe a bit lower to 240 or something (assuming the order is width, length, height)

charred geyser
#

😔

#

rip in peace fixing my problem

digital ibex
#

sorry, i’ve not used mongoose in a while :/

charred geyser
#

rip

drifting wedge
#

well its not working

charred geyser
#

@drifting wedge is there pil support?

drifting wedge
#

?

charred geyser
#

like a discord support server for PIL

drifting wedge
#

i dont think so

#

can i try to center it

#

and move it down?

charred geyser
#

im not even familiar with python sorry

indigo flax
#

Ignoring exception in on_ready
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "bot.py", line 10, in on_ready
await client.change_presence(status=discord.Status.online,activity=discord.Game('COMING SOON | eh!help'))
AttributeError: 'Command' object has no attribute 'Status'

charred geyser
#

errors are bad

#

someone should make a language where its impossible to get an error

indigo flax
#

Ignoring exception in command help:
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot.py", line 17, in help
embed = discord.Embed(
AttributeError: 'Command' object has no attribute 'Embed'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 855, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Command' object has no attribute 'Embed'

livid otter
#

message.user.id viewing user id, i will only view user name example Musti#0001 how to?

#

ingilizcemle dalga geçmeyin

earnest phoenix
#
message.author.tag
livid otter
#

eyvallah reis

earnest phoenix
#

how can i filter from the json file?
i want to get the id of the queue whose name is test.
{"id":12345,"name":"test"}

summer torrent
#

@livid otter english only

earnest phoenix
#

filter(a => a.name === "test")
@summer torrent I want to get the ID of the test

summer torrent
#

then add .id after filter

earnest phoenix
#

How do we fit the id of the test as message.channel.send()?

opal plank
#

What u trying to do?

#

@earnest phoenix

thin turret
#

Object.entries(users)
Returns

[
 [
   '0',
   Collection [Map] {
     '316736211266043904' => [User],
     '725729827683827782' => [User]
   }
 ]
]```
#

How can I access the length of the collection?

opal plank
#

.size

#

@thin turret

thin turret
#

returned undefined, ended up doing Object.entries(users)[0][1].map(size => size).length

#

Looks so ugly KEKW

thick gull
#

TypeError: Cannot read property 'autoRole' of null
@charred geyser remove const from inside of the part where you define guild

#

cause it’s only inside of that part not going out

wicked breach
#

How do you change the color of either your buttons or you background on a top.gg bot page in which you own?

summer torrent
#

you can use html/css on long description

charred geyser
#

@charred geyser remove const from inside of the part where you define guild
@thick gull which file?

livid otter
#

please give 7/24 join a voice channel code me

charred geyser
#

?

summer torrent
#

@livid otter spoonfeeding is not allowed

#

code yourself

thick gull
#

earlier

livid bridge
#

helo

#

pls dont mute dank memer

thick gull
#

if (!settings)
settings = create new guild

livid bridge
#

im wanna play it

thick gull
#

etc

#

play it in your own server

#

it should work then

#

i haven’t touched mongoose in a bit

livid bridge
#

buy why dank muted in here?

thick gull
#

there is a reason I am not aware

#

but it is a good reason

livid bridge
#

eh

#

sad

thick gull
#

@thick gull like this
@charred geyser I haven’t touched mongoose in a while iirc they way you had it earlier is just basic js if I’m looking at it correctly while tired asf

#

if (!settings) settings = new settings

#

like that should work

charred geyser
#

here

thick gull
#

but by adding const

#

i believe it’s limited inside of the if statement

#

is it working fine(?)

charred geyser
#

no

#

well

thick gull
#

try logging it inside of the if statement

charred geyser
#

that part is

#

fine

thick gull
#

oh

charred geyser
#

its the other part thats the issue

thick gull
#

show

charred geyser
#

getting the data from the collection

#

const mongoose = require('mongoose');
let Guild = require('../models/guild');
const Discord = require('discord.js')

module.exports = async (client, guild, member) => {
    let settings = await Guild.findOne({
        guildID: guild.id
    })
    console.log(settings)
    member.addRole(guild.roles.find(role => role.name === settings.autoRole));
};
#

TypeError: Cannot read property 'addRole' of undefined

thick gull
#

member is undefined

#

that’s a discord thing

#

is that an autorole (?)

charred geyser
#

its an attempt

#

yea

thick gull
#

is that in a event

charred geyser
#

thats guildMemberAdd

#

yea

thick gull
#

hm

#

well the error is that member isn’t defined

#

so perhaps you have something wrong there

#

like the placement

drifting wedge
#

does ffmpeg support yt streams?

charred geyser
#

google it

thick gull
#

I’m not sure but that seems like the error

charred geyser
#

yeah

#

but when i console.log(settings) it returns null

thick gull
#

is guild defined?

#

probably

#

but

charred geyser
#

there is no errors until addRole

thick gull
#

yeah

#

I don’t think mongoose will error if guild isn’t defined

#

but it might kekw

charred geyser
#

autoRole*

#

yeah

#

im not sure

thick gull
#

well I haven’t used the member create thing, but the way it works with reactions; messageReaction.message so I’d presume that it would be the same with guilds

#

member.guild rather than guild and member

#

anyways iM probably wrong

#

but hopefully that helps

#

lol

charred geyser
#

it seems like no matter what i change TypeError: Cannot read property 'addRole' of undefined

#

is always the error

#

i have a %prefix command which updates the prefix

#

and it liike

#

actually updates the collection iin the database

#

and this autorole uses the same method

#

well similar

gentle oxide
#

How do I add my bot to this server?

charred geyser
#

first

thick gull
#

well similar
@charred geyser it’s 100% the variables

#

reason settings is null, guild is undefined

#

try logging everything Idk anymore lol

drifting wedge
#

how can i add a reaction to a message

#

and check if the user clicked the reaction?

thick gull
#

check dpy docs (?) kekw

drifting wedge
#

i did

thick gull
#

rip

drifting wedge
#

didnt understand it

#

for example how can i add a reaction to a message?

charred geyser
#

lol

#

@thick gull i just figured it out

#

i think

sweet kestrel
charred geyser
#

you will not believe it

sweet kestrel
#

help

charred geyser
#

and this is what i wrote

#

bum bum bum

#

i litterally spent hours on this

#

and all it was is me typing the wrong name in lmfao

carmine summit
#

must be role.add()

sweet kestrel
#

can anyone help me? I can't get out of that loop

thick gull
#

😩

sweet kestrel
#

is keep senting me 3 messages at a time

carmine summit
#

put return at the end

charred geyser
#

oh apparently

sweet kestrel
#

at the end?

charred geyser
#

that wasn't the issue

#

i mean

carmine summit
#

if (something){
return
}

charred geyser
#

it was an issue

#

but it hasn't solved it

radiant kraken
#

@sweet kestrel you just space the await ctx.send wrongly so it gives indentation error

sweet kestrel
#

where do i put return

carmine summit
#

inside an if statement

sweet kestrel
#

I know, but i don't know how to fix it @radiant kraken

radiant kraken
#

I know, but i don't know how to fix it @radiant kraken
@sweet kestrel align the await ctx.send with the top

sweet kestrel
#

😭

#

the full code

#

is there any thing i did wrong?

charred geyser
#

@carmine summit like this?

    let role = guild.roles.cache.find(r => r.name === settings.autoRole);
    member.roles.add(role).catch(console.error);
drifting wedge
#

await self.add_reaction(accept_decline, emoji=":red:752330198808133642", ":blue:752330312381628517", ":skipquestion:752330657446756382")

ember lodge
#

sends 404

drifting wedge
#

is this wrong?

sweet kestrel
#

what the/....

drifting wedge
#

await self.add_reaction(accept_decline, emoji=":red:752330198808133642", ":blue:752330312381628517", ":skipquestion:752330657446756382")

pale vessel
#

is there any thing i did wrong?
@sweet kestrel is there an error?

radiant kraken
#

Have you tried using message edit?

drifting wedge
#

im trying to add rwactions

sweet kestrel
#

yes

#

@pale vessel

radiant kraken
#

Align the em = with the await ctx.send

pale vessel
#

brug

radiant kraken
#

You can get errors in python just because of wrong spacing

drifting wedge
#

offtopic

pale vessel
#

aren't you supposed to put return before await ctx.send()?

sweet kestrel
#

lol

#

?

pale vessel
#

define the embed first

sweet kestrel
#

do i have to do that?

#

idk

radiant kraken
#

No it's just a misalignment of the spacing iirc

sweet kestrel
#

wait, @pale vessel which ctx.send are you talking about

#

there's 3

#

@radiant kraken do you know how to fix it?

pale vessel
#

null will help you, i'm a noob

sweet kestrel
#

lmao

radiant kraken
#

wait after the return you added a 4 space

sweet kestrel
#

you mean await

#

oh, yes, i did

radiant kraken
#

No i meant after the opening crafting table and return, you added four more spaces

sweet kestrel
#

if i do this

#

is a loop

#

oh, wait not a loop, is just not working

#

for else

radiant kraken
#

The await before the else is not in the if statement

sweet kestrel
#

yeah

#

I took it out

#

@radiant kraken should this work?

radiant kraken
#

no it will still be a loop

pale vessel
#

what is it returning

sweet kestrel
#

😭

#

how to get out the loop?

pale vessel
#

break?

sweet kestrel
#

tried

#

not working

radiant kraken
#

Your await ctx.send embed is in the for loop, not in the if statement

sweet kestrel
#

oh

drifting wedge
#

await self.add_reaction(accept_decline, emoji=":red:752330198808133642", ":blue:752330312381628517", ":skipquestion:752330657446756382")

#

is this right?

#

i want to add reactions

charred geyser
#

bruh

drifting wedge
#

it gives me some syntax errors

sweet kestrel
#

how to get out the loop and make it a if statement then?

charred geyser
#

still TypeError: Cannot read property 'autoRole' of null

sweet kestrel
#

i litteraly don't know how to do that

pale vessel
#

like indent?

radiant kraken
#

em.set_thumbnail ...
await ctx.send(embed=Em)

liks that

sweet kestrel
#

but then that will be in a loop

#

like that you mean

pale vessel
#

but you put return

#

won't that stop the loop?

sweet kestrel
#

a bruh momen

pale vessel
ember lodge
sweet kestrel
#

3 message at a time again 😦

radiant kraken
#

Ah

#

you forgot the break in the else mmLol

radiant kraken
#

add break after the ctx.send

sweet kestrel
#

this is senting both if statment and the else statement

#

willl the break fix it ?

radiant kraken
#

yeah

sweet kestrel
#

like that

charred geyser
#

is guildID: guild.id ok?

radiant kraken
#

No in a new line

sweet kestrel
#

that

radiant kraken
#

Yes

charred geyser
sweet kestrel
#

k, let me run it now

#

🙂

digital ibex
#

wdym @charred geyser