#development

1 messages · Page 1484 of 1

silver monolith
#

ok

pale vessel
#

but it's just key and value

prisma oriole
#

also isnt is KV

silver monolith
#

im sorta a beginner tho

pale vessel
#

well trueeee but there are some other db that you can learn that is just as easy as quickdb

#

like mongodb

#

just findOne() or updateOne() with upsert

#
  • if you like schemas use mongoose
#

some people don't like it since it defeats the purpose of having nosql

mellow kelp
#

yeah mongodb is ez

silver monolith
#

oh

#

ok...

pale vessel
#

idk, i use mongoose

mellow kelp
#

yea same

#

like

#

how can you NOT use some type of model for storing data

prisma oriole
#

i started with mongoose but then i switched to psql because i just found better tbh

#

dk

#

i meant there isnt much comparing them, one is sql on is nosql

mellow kelp
#

yea

#

they can achieve similar stuff

#

one uses tables, the other doesn't

prisma oriole
#

something like typeorm makes postgres pretty effective

pale vessel
#

PoggersDB tho 😎

prisma oriole
#

lmao

mellow kelp
#

yes

#

PoggersDB is the superior database

#

whoa

pale vessel
#

yep, poggersdb is part of jason.db

mellow kelp
#

o

#

ye

#

PoggersDB has an encryption method so strong, it might not even be able to decrypt it 5% of the times

prisma oriole
#

and then theres me that actually thought poggersdb was a real meme db

#

and tryed to search it up

silver monolith
#

i started a conversation here that i have 0 involvement in

prisma oriole
#

tried*

prisma oriole
#

wait what

#

its real

#

wtf

pale vessel
#

yes

prisma oriole
#

thats pog

pale vessel
#

gers

prisma oriole
#

"DO NOT USE THIS IT WAS MADE AS A JOKE"

#

ok at least i was rgiht

#

that it was a meme

#

lmao

mellow kelp
#

lmao yes

pale vessel
#

million was attacked by everyone so he was forced to put that warning and enmap as an alternative

mellow kelp
#

he made the main db thing

#

i made the poggers db

pale vessel
#

i added object nesting support but that's it

buoyant plank
#

made my first bot, but feel like I am spending so many time checking input types and coding things like resolving mentions and I really want to use a framework now

mellow kelp
#

you using any lib?

buoyant plank
#

Ehh, yes, Discord.js, validator, prisma etc.

But I find coding command parsing and input parsing a bit tedious, was thinking about switching to Akairo, but I am afraid of losing flexibility that come with not using someone else's framework

earnest phoenix
#

parsing isn't hard

#

what's hard is making everything fool proof

#

because most of people that are going to use your bot are going to be idiots

mellow kelp
#

yea

#

lets face it

#

users are dumb

gilded olive
#

coding in general isn't hard

#

but when you make discord bots

buoyant plank
#

discord bot is user input hell

gilded olive
#

you have to think of users that didn't pass 2nd grade

mellow kelp
#

i mean

buoyant plank
#

i thought it was the database or calculation or shit that is complicated

#

but after i learned it

#

it is like 20% of my development time

mellow kelp
#

but like

buoyant plank
#

80% of my code in my command consists of chekcing whether they gave me the right input

#

and telling them which one is wrong

gilded olive
#

like youll tell them to do [p]x y and they'll do [p]y x for shits and giggles

mellow kelp
#

does your bot use complicated input or something?

#

you could simplify it in some way to reduce the amount of validation

#

and remember

#

regex is always your friend

quartz kindle
#

wanna talk about complicated intputs?

#

you can literally make a 2000 char command with my bot

buoyant plank
#

"hello this command help you convert between currency"

#

[prefix]convertcurrency [currency type] [currency number]

gilded olive
quartz kindle
#

nope

buoyant plank
#

User: *Prefix 100USD

mellow kelp
#

"i worked really hard on this please dont screw it"

buoyant plank
#

@buoyant plank ???? Y U NO WORK!????

#

literally my life

mellow kelp
#

lmao that happens all the time KEKW

gilded olive
#

I always put checks to see if input is higher than like 450

mellow kelp
#

Y UR BOT NO WORK?11!!11!??!

buoyant plank
#

y your bot not intelligent enough to parse my currency symbol no matter which end of the command i put it in

#

granted my docs could be better but

mellow kelp
#

basically "why doesnt your bot have ai to handle my stupidity!!'???!"

gilded olive
#

what I do whenver they miss an argument is just send the help command for that command

buoyant plank
#

I still haven't added the ability to parse mentions so I am forcing all users to use their UserID, and I was wondering if I am reinventing the wheel and just better off using a framework like akairo for task like

gilded olive
#

fixes everything

buoyant plank
#

finding if a user exists given a id / mention / name etc.

mellow kelp
#

message.mentions.users.first()

buoyant plank
#

atm i have my command parse arguments by position

mellow kelp
#

ohh yea doing that is one hell of a time

buoyant plank
#

xyeah, it is slighlty more complicated commands I am struggling with

mellow kelp
#

how about regex

#

its pretty simple to match a mention

buoyant plank
#

yeh

#

I'm just trying to see if I can improve the usability

#

by changing the parameter in my commands that require userID

#

to accept also mention

gilded olive
#

laughs in py doing this automatically

buoyant plank
#

because it is kinda tedious

#

for my user to copy their own ID

#

or someone else's to do every action that need a user

gilded olive
#

discord.js dosent auto convert?

buoyant plank
#

don't judge me i set up database and everything but not even how to parse a mention

mellow kelp
#

but he wants mentions on specific arguments

gilded olive
#

hmm but why tho

#

why not allow them to pass either the 3, name, mention or id

buoyant plank
#

that's what i want to do

#

but

#

just wondering how to do it

gilded olive
#

alllowing only mentions is kinda hmm

mellow kelp
#

sus

gilded olive
quartz kindle
#

i prefer parsing mentions with regex

#

that way it works for both mentions and ids with the same code

mellow kelp
feral aspen
#

Hey

quartz kindle
mellow kelp
#

o

#

well

ivory seal
#

https://discord.com/api/v8/guilds/789704325899223110/ where do i put the authorization after this

earnest phoenix
#

in the request header

feral aspen
#

in the guildCreate event, is the guild name and ID as guild.name and guild.id?

#

Correct guys?

earnest phoenix
#

see your library's docs

ivory seal
#

https://discord.com/api/v8/guilds/789704325899223110/Authorization:Bot mytokenhere but that doesn't work returns 404

fierce ether
#
.heading {
    padding: 300px 50px !important;
    color: #fff !important;
    background-image: url("../imgs/wavy-purple-by-nouridio.svg") !important;
    background-position: bottom !important;
    background-size: 400% !important;
    background-repeat: no-repeat !important;
}``` is there a way to only animate the image?
ivory seal
#

got it

#

thanks

earnest phoenix
#

and then animate that

fierce ether
#

what would the element be though?

earnest phoenix
#

...anything you want

ivory seal
#

i don't suppose u can use the node-fetch module to use headers?

pale vessel
#

...you can

#
fetch(uel, {
    headers: { here }
});```
#

uel

#

okay dude

ivory seal
#

ah kk

earnest phoenix
#

you tried and that's what matters

ivory seal
#

thanks

#

i did search up http headers

#

and im looking at

#

the mozilla docs for it

fierce ether
#

wait @earnest phoenix is there a way to change image color only

#

i only know background-image

earnest phoenix
#

what

fierce ether
#

dw

tardy hornet
#
  if(message.author.id === "723081690792067143") return message.channel.send(`![witch](https://cdn.discordapp.com/emojis/793149914476445696.webp?size=128 "witch") ${args.slice(0).join(" ")} ![witch](https://cdn.discordapp.com/emojis/793149914476445696.webp?size=128 "witch")`)

i want it to slice nothing,

#

its always slicing the first word

misty sigil
#

what

#

just type message.content?

pale vessel
#

slice(0), okay

#

might as well not slice then

tardy hornet
left pasture
#

how do i get a webhookauth ?

tight scaffold
#

how do i set a image background for the page? kinda new to html/css

pale vessel
#

background-image?

tight scaffold
pale vessel
#

if you want to set the background for the whole page you can use body I guess

#

body { background-image: url(<url here>); }

tight scaffold
earnest phoenix
#

Can we get members and channels without having privilege intents

tight scaffold
#

nop

gilded olive
#

no

earnest phoenix
#

I

#

Okok

pale vessel
#

you don't need privileged intents for those

tight scaffold
#

you do

earnest phoenix
#

Oh

gilded olive
#

For members yes

tight scaffold
#

Members intents

#

for members

gilded olive
#

Channels idk

#

But members you do

earnest phoenix
#

Channels from other servers

#

Yes

pale vessel
#

you don't if you're not planning on fetching all members

earnest phoenix
#

Can we actually do that

pale vessel
#

yes

earnest phoenix
#

Oka

gilded olive
#

for loop

earnest phoenix
#

I will try

pale vessel
#

it's just the presence

#

you need privileged intent for presences

earnest phoenix
#

Oh

#

I don't have either of the two turned on

#

And when I asked discord to turn them on for my bot

#

They replied with a big no

tight scaffold
#

you need to send in an example of why

earnest phoenix
#

I did

tight scaffold
#

including code, and why its needed

pale vessel
#

you can't if it's not for original commands

#

like statistical commands

#

userinfo for example

earnest phoenix
#

Oh

#

I need for sending dms

#

To ppl

tight scaffold
#

greet?

mellow kelp
#

why?

tight scaffold
#

greet dms

earnest phoenix
#

Nah

#

Like an alert kinda thing

tight scaffold
#

like carls highlights?

earnest phoenix
#

Idk

#

If the fetch all works

#

Will do good for me

tight scaffold
#

you need intents to fetch all

earnest phoenix
#

Maybe I should ask dixcord dev then

tight scaffold
#

am i able to customize the invite button color?

pale vessel
#

yes of course

tight scaffold
#

whats the selector for it, like i said, new to html/css

grave geyser
#

how i can check if a user vote or not?

gilded olive
grave geyser
#

ok tnx

fierce ether
#
body {
    font-family: 'Poppins', sans-serif !important;
    background-color: #1B1B1B;
    color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-size: 16px;
    line-height: 5px !important;
    border-top: 6px #9e8ff6 solid !important; 
    animation-name: animateWave;
    animation-duration: 0.1s;
}``` i only want to animate the border top not the whole body?
feral aspen
#

Should I consider a server channel a String or Number?

#

Can be both right?

mellow kelp
#

yea ig

#

in my case discord.js uses strings so thats what i use

#

but i guess some libs like jda also use numbers

feral aspen
#

Hm..

#

I am trying to make something where people can set a channel for message events

pale vessel
#

you can't use number for ids in js because they won't transfer properly

feral aspen
#

but when the bot joins a server, it register's the server's data, including the server channel events where it sends out the message events, but since the owner didn't set the channel, I put it as undefined, but it didn't work since I set it as a string, what can I do instead?

#

eventsChannel: String

When I register it's data, I made it:

eventsChannel: undefined - cause since there is no channel to send to

.. but it didn't work..

#

is undefined not considered as a string? should I make it like "undefined" instead? 🤦‍♂️

neat hearth
#
@client.event
async def on_member_join(member):
  print(f'{member} Sunucuya Geldi, Hoşgeldi!')
  channel = client.get_channel(711189995431395378)
  embed=discord.Embed(title=f"{member} Sunucuya Katıldı.", color=0x000000)
  embed.set_image(url=f"{member.avatar_url}")
  embed.add_field(name="ID", value=f"`{member.id}`", inline=False)
  embed.add_field(name="Hesabın Yaşı:", value=f"`{member.created_at}`", inline=False)
  await channel.send(embed=embed)

discord.py rewrite
the on_member_join is not detecting when a user joins the server
i cant see any problems
what did i do wrong?

mellow kelp
#

@feral aspen undefined is a different type than string

feral aspen
#

What can I do?

#

If the eventsChannel is a string cause it's an ID, and now when the bot joins a server, there will be no server channel so it's undefined, but undefined doesn't work. What can I put instead?

mellow kelp
#

i guess you can just leave it as undefined

#

unless you want to always have a channel registered, then finding some other channel is up to you

earnest phoenix
#

or an empty string

feral aspen
#

@mellow kelp Should I put "undefuned" with the ""

earnest phoenix
#

an empty string is a falsey value

mellow kelp
#

yea

#

but don't put 'undefined'

feral aspen
#

What do I put?

#

What can I put as undefined?

pale vessel
#

just put null

feral aspen
#

null?

mellow kelp
#

yeah

#

null

#

its like undefined

#

but

#

less undefined

feral aspen
#

K

#

Will try

mellow kelp
#

kk

earnest phoenix
#

null is treated as an object

mellow kelp
#

oh yea

earnest phoenix
#

it's an actual value, unlike undefined

mellow kelp
#

for some reason typeof null === 'object'

feral aspen
#

It worked!

pale vessel
#

typeof NaN === "number"

#

awesome js

feral aspen
#
if(eventsChannel === null) return;
#

... seems to work. Thanks!

mellow kelp
pale vessel
#

if (!eventsChannel)

#

no? ok

mellow kelp
#

yea that works too

#

looks cleaner ig

hidden knot
#

My bot’s Profile Img Is Not Working. Mide if you can take a look?

sterile lantern
#

would this function work with webhooks

#

client.on('message', async (message) => {

#

no bot token or anything just a webhook sending requests

#

or should it be webhook.on MonkaHmm

#

time to test

earnest phoenix
#

which webhooks

#

discord webhooks?

sterile lantern
#

Yes

earnest phoenix
#

webhooks are purely REST

#

they don't go through the gateway

#

ergo no events

sterile lantern
#

oh rip

#

I’ll probs use slash commands

#

when they’re fully released

#

cuz if I make it now I’ll probs have to some more changes in the future

earnest phoenix
#

@sterile lantern slash commands are epic for everything and i am waiting like fuck till discord.js v13 is released so i can use them

#

they're trash

#

you lose more than what you get

mellow kelp
#

they would have been better if they had been introduced long ago

earnest phoenix
#

but for dumbos like me they're revolutionary

#

look, if you can help me, I appreciate it I'm trying to use innerHTML to set a text for the username of the user who logged in to the site (html) my code is:

#
<!DOCTYPE html>
<html>

<head>
    <title>Fleeh</title>
</head>

<body style="background-color:gray">
    <div id="info" style="color:white">.</div>
    <a id="login" style="display: none; color: white;" href="https://discord.com/api/oauth2/authorize?client_id=753658112728105000&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&scope=identify">Login</a> 

            <script>
                window.onload = () => {
                    const fragment = new URLSearchParams(window.location.hash.slice(1));
                    if (fragment.has("access_token")) {
                        const accessToken = fragment.get("access_token");
                        const tokenType = fragment.get("token_type");
                        fetch('https://discord.com/api/users/@me', {
                            headers: {
                                authorization: `${tokenType} ${accessToken}`
                                }
                                }).then(res => res.json()).then(response => {
                                    const { username, discriminator } = response;
                                    const texxt = document.getElementById("info")
                                    texxt.innerHTML = username;
                                    }).catch(console.error);
                                    }	 else {
                                        document.getElementById('login').style.display = 'block';
                                        }}
    </script>
</body>

</html>
#

How Can I Import Text From pastebin?

earnest phoenix
mellow kelp
#

probably copy-paste

earnest phoenix
#

like in stead of putting lines like this
test
test
test
test
and then use \n

mellow kelp
#

you mean to import code from pastebin programatically?

earnest phoenix
#

is it being complicated?

mellow kelp
#

like, using code

earnest phoenix
mellow kelp
#

im gonna see

#

wait a sec

earnest phoenix
#

so im making a generator bot

mellow kelp
#

pretty sure you can just use fetch() or axios

#

make a request to the raw text and get the response data

earnest phoenix
#

fetch it then just get the text from request body

#

Oh god

#

What the fuck did we just do

#

@mellow kelp

#

that's a... generator bot

#

we?

#

excuse me?

mellow kelp
#

wat

earnest phoenix
#

nothing

#

those are against tos

#

and we just helped em make it

mellow kelp
#

oh no

earnest phoenix
#

no you didnt helped make it...

#

its a multipurpose bot

#

...

mellow kelp
#

but its also a generator

earnest phoenix
#

yeah

#

can you tell ?

#

the solution?

#

generator bots are against tos

#

we're not helping

cinder patio
#

Do you have a different message listener for each one of your commands?

mellow kelp
#

awful isn't it

earnest phoenix
#

wtf dym shoudl i use else if now?

#

He is too dangerous to be kept alive!

#

kill me then

mellow kelp
#

we've been telling you that since like

earnest phoenix
#

or even slash commands

mellow kelp
#

learn

earnest phoenix
#

at least discord.js commando is good

#

give an example

pale vessel
#

that direct-link domain does not look legit at all

mellow kelp
#

yeah at least use commando

pale vessel
#

commando is kinda dead tho

mellow kelp
#

that one should be easy enough

earnest phoenix
#

and also PLEASE STOP TRYING TO MAKE A GENERATOR BOT

#

whats the point of sending in caps?

earnest phoenix
mellow kelp
#

lmao

#

i just write a simple command handler for every bot i make

#

takes about 3-5 minutes

#

or i just copy code from older projects and re-adjust it

earnest phoenix
#

when slash commands are released all command handlers will be a joke

#

because it's better for the user

mellow kelp
#

nah

#

well thats a good point

earnest phoenix
#

because nobody wants karens screaming in #support they can't follow instructions

mellow kelp
#

i guess each bot will have 1 slash command with sub-commands right?

earnest phoenix
#

because nobody wants karens screaming in #support that they can't follow instructions

mellow kelp
#

because many bots will probably have commands with the same name

cinder patio
#

there can be multiple commands with the same name, they just have to belong to a different bot

mellow kelp
#

Oh that makes sense

earnest phoenix
#

and discord isn't dumb enough to fix those

#

afaik

#

Emphasis on afaik

rocky hearth
#

How can we get inputs from cmd, for nodejs application?

earnest phoenix
rocky hearth
#

No no! I'm not talking about discord bot dev

pale vessel
#

use std or readline

earnest phoenix
#

oh you mean from the console

#

use readline

#

and use yargs if you want a fancy syntax for args

rocky hearth
#

can u share any good article/videos or anything?

earnest phoenix
#

¯\_(ツ)_/¯

rocky hearth
#

😅 OK

hearty lichen
#

(╯°□°)╯︵ ┻━┻

feral aspen
#

Is there an if statement to detect if a message in the messageDelete event is an embed?

#

It errors unfortunately.

earnest phoenix
#

oh wait

#

but

#

embeds are too easy

stark abyss
#

anyone got an idea on how I can do something everyday at midnight?

mellow kelp
#

cron jobs

stark abyss
#

or how to get the 12 am time in js

stable eagle
#

Can you use the "this" keyword in JSON?

mellow kelp
#

nope

stable eagle
#

Ok

mellow kelp
#

@stark abyss i'd say use node-cron

stark abyss
#

oh

mellow kelp
#

you can schedule functions to be ran at certain times

stark abyss
#

alright ty

mellow kelp
#

np

quartz kindle
#

12am in which timezone lul

stark abyss
#

local

mellow kelp
#

how about utc 0

stark abyss
#

I need to do something every 24 hours, doesn't really have to be local ig

quartz kindle
#

i just use a timeout and an interval

#

i have a script that posts a webhook every 24 hours too

mellow kelp
#

i think setInterval isn't too precise for stuff like 24h

#

is it?

quartz kindle
#

thats why you use both

stark abyss
#

but my bot isn't very stable it goes down every day bad vps xd

quartz kindle
#

a timeout to find the next desired moment, then a interval to start from there

mellow kelp
#

how about cron jobs

quartz kindle
#

this is my script ```js
setTimeout(() => {
run();
setInterval(() => {
run();
}, 86400000);
}, 86400000 - (Date.now() % 86400000));

mellow kelp
#

those use date to schedule stuff

quartz kindle
#

no need for cron jobs

stark abyss
#

but if my bot goes down it will mess up

quartz kindle
#

nah

mellow kelp
#

with the proper calculations, nah

quartz kindle
#

only if it goes down precisely at the moment it was supposed to send

#

then it will only send the next day

mellow kelp
#

then you gotta wait another day KEKW

stark abyss
mellow kelp
#

but like

#

scheduling with cron is easier i think

#

just google the crontab for what you want and let cron do the scheduling for you

stark abyss
#

I read their docs

quartz kindle
#

cron is easier yes, if you're ok with relying on your system

#

i prefer having my scripts self contained

mellow kelp
#

yeah guess it depends on that

stark abyss
#

Yeah I think I'll just do what tim said, thx both of you

#

I also gotta do one for weekly nani that number * 7 should do it right?

quartz kindle
#

yup

stark abyss
#

okay RapSmiles

mellow kelp
#

looks like math at school actually had a purpose pogey

stark abyss
#

not reeally

mellow kelp
#

more or less

quartz kindle
#

early math is super useful

mellow kelp
#

yeah definitely

quartz kindle
#

i never studied math past 7th grade

#

but i use stuff from 5-6th grade all the time

stark abyss
mellow kelp
#

i just realized ts-node has an interactive console

#

this is so weird

earnest phoenix
#

there is like a json file. I need to parse it through js so that when a user provides a query,
It can search through the json file and find the optimal result

//json file

{
name: "test1"
},

{
name: "test2"
}


//user query

!search test1
#

im kinda to new to it

#

so yea

stark abyss
#

I think people recommend not using json file as database

misty sigil
#

array

#

wait no

earnest phoenix
#

not as a database

misty sigil
#

use object

pure lion
#

Matt

stark abyss
#

oh my bad

earnest phoenix
#

i have a predefined json file

misty sigil
#

wait am i

pure lion
#

JSON.parse()

#

Makes JSON into an object

earnest phoenix
#

hm

pure lion
#

So you can just require the file and JSON.parse it

misty sigil
#

<jsonfile>.find(g => g.name == 'query')

#

iirc

mellow kelp
#

well

#

actually

misty sigil
#

if json file is an array

mellow kelp
#

there are two ways

misty sigil
#

which it seems to be

earnest phoenix
misty sigil
#

because there are no keys

earnest phoenix
#

//json file

[ {
name: "test1"
},

{
name: "test2"
} ]

mellow kelp
#
// Way 1:
const json = require('./my-file.json');

// Way 2:
const fs = require('fs');
const data = fs.readFileSync('./my-file.json').toString();
const json = JSON.parse(data);
earnest phoenix
#

hm

#

ok thanks

mellow kelp
#

np

sand cape
#

hi

#

ı am Berk

earnest phoenix
#

?

stark abyss
#
const hour = new Date(Date.now()).getHours();
if(hour == 24){
  console.log("F")
}
``` I realized I could just do this xd
earnest phoenix
#

you can just do new Date()

#

getHours also returns 0-23 iirc

mellow kelp
#

and are you gonna run that in a loop?

stark abyss
#

oh shit I didn't think about that NanaWtf

marble juniper
#

does anyone know if i can run 2 for loops in javascript parallel to each other

solemn latch
#

you mean workers?

marble juniper
#

basically not waiting for one to be complete

#

just running 2 for loops at the same time

#

thats what I wanna do

#

lol

solemn latch
#

at the exact same time, id think workers would be the solution.

mellow kelp
#

would async stuff work there?

#

or is that for another thing

solemn latch
#

you can still only done one thing at a time with async

marble juniper
#

yeah I have found something in node.js docs

solemn latch
#

just the async ones would be done after

marble juniper
#

there is a worker thread package

earnest phoenix
#

cant find module ./xp.json
Yet its a file and there is the corresponding file.

solemn latch
#

is it in the correct location?

earnest phoenix
#

As in?

#

1 sec

solemn latch
#

./ checks a specific point in your projects folder, is xp.json in that location

earnest phoenix
#

It isnt in a folder

#

Its just xp.json

solemn latch
#

everythings in a folder, unless you put it in your c drive 🤔

earnest phoenix
#

The command is in src/commands

#

I have many folders

#

Events, Commands, Database, Handler,

#

Then no folders

#

Which is what xp.json is on

solemn latch
#

so, the ./ is looking in the commands folder(./ is relative to the file that the code is running in)

earnest phoenix
#

Yyp

solemn latch
#

and your xp.json isnt there

earnest phoenix
#

There is an xp.json

solemn latch
#

in the commands folder?

earnest phoenix
#

No

solemn latch
#

well, ./ says to look in the commands folder

#

since your in a file in commands

earnest phoenix
#

Moved it

solemn latch
#

so it cant find it

#

or just put the right path

#

which is ../ probably.

earnest phoenix
#

When i put .. It errored the whole thing lemme go try it rq beb

#

Brb

glacial pagoda
#

How Can I Add My Bot To The Server?

solemn latch
#

to this server?

glacial pagoda
#

Yeah

solemn latch
#

we dont add bots here

glacial pagoda
#

You Dont?

solemn latch
#

no.

glacial pagoda
#

What About The Testing

solemn latch
#

testing channels dont exist anymore, just #commands

glacial pagoda
#

There Are People With Their-

solemn latch
#

where 🤔

glacial pagoda
#

What About The 6000+ Bot Devs

solemn latch
#

those are bot developers

glacial pagoda
#

How Do I Become One Of Them

solemn latch
glacial pagoda
#

Oh Ok

solemn latch
glacial pagoda
#

Ill Do It Rn

#

I Have a Bot Ready

solemn latch
#

yeah, you have to have a host

earnest phoenix
#

It is erroring the whole code now

glacial pagoda
#

I Use Heroku

solemn latch
#

what did you put 🤔

earnest phoenix
#

./src/commands/xp.json

solemn latch
#

your already looking in the relative file.

earnest phoenix
#

Which is corresponding to where the file issss

solemn latch
#

your looking in /src/commands/src/commands/xp.json

#

which doesn't make any sense.

#

lemme see if i can find a guide that explains relative pathing

sudden geyser
#

Why is it called the C drive

solemn latch
#

a and b where taken

sudden geyser
#

grr

sly fog
#

Hey guys. For some reason this very easy code isn't working and.... I don't know why. Any ideas?

client.on('guildMemberAdd', member => {
  client.channels.cache.get('793215879264731146').send("Test"); 
});
solemn latch
#

do you have the members intent?

sudden geyser
#

Well what isn't working about it

#

Does it emit anything, does it throw an error? Like woo said you may need the members intent

sly fog
earnest phoenix
#

Fixed. Now I get another error lmaoo

#

This is just great

solemn latch
#

going through errors is normal in programming

glacial pagoda
sly fog
#

Mine isn't working, I don't know why. :/

glacial pagoda
#

If You Are Doing A Welcome Thing And The Bot Adds A Role

#

You Have To Specify What Role

solemn latch
glacial pagoda
#

You See Like-

#

Bruh

sly fog
#

I just want the bot to send a message.

earnest phoenix
#

tfw you don't know ids exist

solemn latch
#

your bot will probably be ratelimited every time a user joins.

#

spam giving roles will get you ratelimited quite quickly.

glacial pagoda
#

let welcomeRole = guildMember.guild.roles.cache.find(role => role.name === 'Role Exact Name');

#

welcomeRole Is The Name Of The Thing

#

And Then Role Exact name Is What The Welcome Role Will Be

#

guildMember.roles.add(welcomeRole);

#

Thats After

#

So It Adds The Welcome Role

#

To the User Joining The Server

#

It Pretty Much Just Creating a Variable

#

And Giveing User a Welcome Role

#

Anyways, I Have To Go Rn To Get Covid Tested

#

Its Going To Hurt ;-;

#

@sly fog

#

Look

solemn latch
#

he just wanted to send a message my man

glacial pagoda
#

lol

earnest phoenix
#

just a question

#

how old are you

glacial pagoda
#

Me?

earnest phoenix
#

yes

glacial pagoda
#

13

#

Why

earnest phoenix
#

and i'm bill gates

glacial pagoda
#

:/

sly fog
#

I don't need roles, and I know how to do it. I just want to know why my code isn't working lol, but thanks for your help! @glacial pagoda

glacial pagoda
#

np

solemn latch
#

guildMemberAdd needs the member intent iirc.

#

which is probably why its not working.

wintry stream
#

channel.cache.get not good

solemn latch
#

dont think any channel types have .cache

#

so it wouldnt work

#

client.channels does however

earnest phoenix
#

ya

marble juniper
#

if anyone wants my script that I use to test my ai just look at this

#

lol

#

3 files

#

that I use

#

full src code

#

no api keys doe

#

ofc

#

you can use it to test my ai

earnest phoenix
#

how do i create an emoji with a link to the image in dpy

#

like

#

!add <nameofemoji> <emoji_link>

opal plank
marble juniper
#

yes

#

it is

#

it uses nsfwjs

#

and a tensorflow.js model from my github repo

solemn latch
earnest phoenix
#

k

marble juniper
#

also yall should tell me if my code looks good or not

#

lol

opal plank
#

im still procrastinating on using canvas

marble juniper
#

Im not so sure if it is good

gilded olive
#

dealing with emojis are fairly easy, should just let them use an actual emoji

misty sigil
#

@opal plank do it

opal plank
#

i need to do another framework for the childprocess to work on that though

marble juniper
opal plank
#

i saw

marble juniper
#

pretty much the accuracy is always 95% for me

#

lol

#

and 4 to 5% false negatives

#

no matter how many images

#

95.16129032258064% accuracy to be exact

solemn latch
#

if only it was 95.16129032258065%

marble juniper
#

lol

earnest phoenix
#

i am trying to add an emoji by link but not sure how to do it without downloading the emoji (dont want to do this as it wastes a lot of space)

#

you need to download it

solemn latch
#

did you look at your libs docs?

earnest phoenix
#

downloading != saving on your drive

solemn latch
#

^

opal plank
#

wastes a lot of space huh...

#

1.6gb of emotes lmao

gilded olive
earnest phoenix
#

ok

gilded olive
#

Read the docs for emojis lol

earnest phoenix
#

ok

silver monolith
#

so im trying to make a command where it says something, then prompts you to respond

#

and if you respond the right thing it does something

#

and if you respond the wrong thing it does something else

#

discord.js

#

how do you do that exactly

#

lol

#

how do you do that exactly

#

lol

solemn latch
#

a message collector, and an if else statement

silver monolith
#

how do you make a message collector

#

how do you make a message collector

mellow kelp
#

read the docs

solemn latch
#

or the djs guide

earnest phoenix
smoky herald
silver monolith
#

well uhh i did discord.js guide

#

i got it

smoky herald
#

glad to hear! well done 😄

solemn latch
#

docs are for explaining things in a way devs understand, the guide is more for learning how it works.

#

its important to learn how to use the docs, as many libs dont have a guide

#

just docs

gilded olive
#
 document.querySelector('.toggle').addEventListener('click', function() {
    this.classList.add('animate');
    
    setTimeout(() => {
        this.classList.toggle('active');
        document.querySelector('.wave').classList.toggle('active');
        document.documentElement.classList.toggle('theme-dark');
    }, 150);
   
   setTimeout(() => this.classList.remove('animate'), 300);
});```
#

can I do this in python or is that kinda not possible

crimson vapor
#

This is on html?

solemn latch
#

yeah looks like front end js

#

dont think python has any front end capabilities right now.

gilded olive
#

yea it is on html

#

activates a css thingy

solemn latch
#

js is the standard way of doing front end web development, but seems a few python front end's exist. not sure how much browsers support them.

gilded olive
gilded olive
earnest phoenix
#

you can do frontend on almost anything

#

it just needs to have SSR capability

pure lion
#

SSR?

earnest phoenix
#

the reason why people don't really do that though is because there's lack of community libraries for building your site

pure lion
#

Oh nvm

earnest phoenix
pure lion
#

Nextjs moment

#

I mean it kinda makes sense

#

Transpiling py to js 02Yay

earnest phoenix
#

wasm

#

yum

#

hopefully one day we'll get to the point we won't need js to invoke wasm

#

just imagine publishing a qt app to the web and avoiding html and js

pure lion
#

That would be really cool

#

Rust to wasm tho, imagine the potential

#

So many UI libs

#

I mean you can already do it

#

I think

#

But having chrome be able to render raw wasm "would be cool"

honest perch
#

Cock

gilded olive
#

rock

honest perch
#

@misty sigil

misty sigil
#

bro

crimson vapor
#

@misty sigil

misty sigil
#

stop

crimson vapor
#

Chill it’s a joke

earnest phoenix
stark abyss
fierce ether
#
<p class="cardone-title" style="font-size: 50px !important;line-height: 15px !important;letter-spacing: -0.06em !important;font-weight: bold !important;"><%guilds%></h1>``` guilds dosent show anything ```  res.render('index', {guilds: client.guilds.cache.size});```
knotty carbon
#

you need todo <%=guilds%>

#

@fierce ether

fierce ether
#

same thing

knotty carbon
#

did u define client?

fierce ether
#

res.render('index', {guilds: client.guilds.cache.size});

#

and yes

knotty carbon
#

Should work in my eyes if you change this <%guilds%> to this <%=guilds%> in the .ejs file

#

Could you try to console log it out like this? console.log(client.guilds.cache.size); right after the res.render line

fathom nymph
#
const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js')

module.exports = (client, message) => {
  const channelId1 = client.channels.cache.get('792313562520485932') // Welcome Channel
  const channelId2 = client.channels.cache.get('792313562520485932') // Farewell Channel

  client.on('guildMemberAdd', member => {
    let avatar = member.user.displayAvatarURL({ dynamic: true })
    const greeting = new MessageEmbed()
      .setTitle('New member! Let\'s welcome them!')
      .setDescription(`Warm welcomes to <@${member.id}>! :partying_face:, We hope you enjoy our server!`)
      .setThumbnail(avatar)
      .setFooter('A new member!')
      .setColor('#77dd77')

    const channel1 = member.guild.channels.cache.get(channelId1)
    channelId1.send(greeting)
  })

  client.on('guildMemberRemove', member => {
    let avatar = member.user.displayAvatarURL({ dynamic: true })
    const farewell = new MessageEmbed()
      .setTitle('A member just left!')
      .setDescription(`<@${member.id}> just left the server... 😧`)
      .setThumbnail(avatar)
      .setFooter('We lost a member')
      .setColor('#ff6961')

    const channel2 = member.guild.channels.cache.get(channelId2)
    channelId2.send(farewell)
  })
}```
#

Hey when i do that

#

It logs when another user joins in another server

#

but its supposed to log it in the server who joined in That Server

fierce ether
#

@knotty carbon returns zero idk why

knotty carbon
#

the number 0?

fierce ether
#

yes

knotty carbon
#

is the bot in any server?

fierce ether
#

yes

#
(async () => {
  client.commands = new Map();
  client.events = new Map();
  client.prefix = process.env.DISCORD_BOT_PREFIX;
  await registerCommands(client, '../commands');
  await registerEvents(client, '../events');
  await app.listen(port, () => console.info(`Listening on port ${port}`));
  await client.login(process.env.DISCORD_BOT_TOKEN);
})();```
knotty carbon
#

Weird, i don't know

#

Maybe somehow the guild isn't cached

fierce ether
#

this correct

#
const session = require('express-session');
let port = 3000;
app.set('port', port);
app.set('views', __dirname + '/website/views');
app.set('view engine', 'ejs');
app.use('/assets', express.static(path.join(__dirname, "/website/assets")));
require('./website/router')(app);```
#

its weird because the command works

#

and shows the guild count

knotty carbon
#

Okay, that's definitely weird. But i don't think that i can help with that, sry.

fierce ether
#

thanks anyways

knotty carbon
#

And can't do much if i don't have the full code and not only small areas

mellow kelp
#

im pretty sure you don't need path.join for express.static if the static folder is at the root

fierce ether
#

its not

mellow kelp
#

o

#

well then

#

what doesn't work btw?

fierce ether
#

it shows guild count as 0

mellow kelp
#

is the cache empty?

fierce ether
#

no

#

does a user have to login first

knotty carbon
#

login where?

dire obsidian
#

Someone know what its the meta tag to set a embed color?

mellow kelp
#

pretty sure its theme-color

zenith terrace
stable nimbus
#

How does one filter roles by ID again? I am apparently having issues with this and what I am getting on my searches is turning up empty.

#

Or can I use message.guild.member.roles.has somehow? Cause it can't read "has" of undefined and I'm trying to figure out what my syntax error is or what I'm just not filtering right.

#

cache exists

#

Found the documentation, all good now.

lost berry
#

-needdev

gilded plankBOT
#

DBL is not a place to find developers for jobs. You can try and put a request on Fiverr or Freelancer. Please do not post the request again. Doing so may result in punishment.

old cliff
#

hmm

manic sequoia
#

so oauth2 without redirect_uri will invite the bot to our server and oauth2 with redirect_url will send a data so we can use it on bot control panel like https://discord.com/oauth2/authorize?client_id=340319472357474304&redirect_uri=https%3A%2F%2Fkitrobit.com&response_type=code&scope=identify guilds, am I right?

Discord

Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

fierce ether
#
    .ds-top {```
#

apparently } is exprected?

rustic nova
#

yes?

#

that is how css works

#
.classname1 {
background: green;
}

#classname2 {
background: white;
}
molten cobalt
#

can anyone help me out?

cold swallow
#

@molten cobalt

rustic nova
#

that's python, not js

cold swallow
#

The library is messing

rustic nova
sudden geyser
molten cobalt
#

@sudden geyser ohk

austere herald
#

I have a non-public registration bot. But I want that bot to send a login message when someone joins my server. You'd better send the code to me private

sudden geyser
#

Secondly, I don’t know if you’ll have access to it in the terminal. Maybe in the environment

rustic nova
sudden geyser
#

Thirdly, use python3 instead of python for the interactive shell command

austere herald
#

If anyone knows the code, please send it to me

earnest phoenix
molten cobalt
austere herald
pale vessel
rustic nova
#
if (user.isRegistered()) {
user.login()
}


pale vessel
#

that looks so java

rustic nova
#

Lemme cry inside of trying to write js SadBlep

#

Though we cannot help you with your idea @austere herald, we can only link you to resources that might help with your goal

austere herald
#

ok

pale vessel
#

user.getUser().getDetails().isRegistered();

#

user.login().queue()

manic sequoia
#

How to set our music bot deafen when joining a server?

pale vessel
#

More to a VC than a server

#

What's your library?

earnest phoenix
#

pls help

pale vessel
#

Dank Memer is kicked

#

wait oh

rustic nova
pale vessel
#

😩

earnest phoenix
fallow agate
#

how can I send it to log when the channel I specify on Twitch starts stream (with which module or api)

slender thistle
#

@earnest phoenix show your code

manic sequoia
molten cobalt
#

@earnest phoenix show us your code

earnest phoenix
#
import os
from itertools import cycle
import discord
from discord.ext import commands, tasks
from dotenv import load_dotenv

# import praw

load_dotenv()

bot = commands.Bot(command_prefix='$')


@bot.event
async def on_ready():
    print('We have logged in as {0.user}'.format(bot))
    change_status.start()

#status = cycle(['WhiteHatJr SEO', ' with wolf gupta', 'with Lana Rhoades'])
status = cycle(['Alexshcer-Bot is being upgraded by his owner Alexshcer','Playing music','Listening Mine by Alexshcer!'])

@tasks.loop(seconds=300)
async def change_status():
    await bot.change_presence(activity=discord.Game(next(status)))


@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CheckFailure):
        embed = discord.Embed(title=':x: oops! You do not have permission to use this command.',
                              color=discord.Colour.red())
        await ctx.send(embed=embed)
    elif isinstance(error, commands.MissingRequiredArgument):
        embed = discord.Embed(
            title=':x:You are missing the required arguements. Please check if your command requires an addition arguement.',
            color=discord.Colour.red())
        await ctx.send(embed=embed)
    elif isinstance(error, commands.CommandNotFound):
        pass


for filename in os.listdir('./cogs'):
    if filename.endswith(".py"):
        bot.load_extension(f'cogs.{filename[:-3]}')

bot.run(os.getenv("I can't give you the token"))
molten cobalt
slender thistle
#

You're shitting me

molten cobalt
#

what?

slender thistle
#

The struggle of helping people who send you code snippets in DMs and then say "don't use or share it"

#

And that doesn't even use PRAW so I don't see how that helps

#

@earnest phoenix I know you downloaded it, talk here instead

molten cobalt
#

I am not a good developer of py basically

slender thistle
#

Show me where you actually do import praw and ACTUALLY initialize its client

rigid vale
slender thistle
#

Christ Lord help my soul

slender thistle
rigid vale
#

Ohh what's the supported languages?

slender thistle
#

@earnest phoenix See my messages here and stop DMing me with things that don't help in any single way

#

I know you downloaded praw and that it's installed

earnest phoenix
old cliff
#

Chose memes by hot not top

slender thistle
#

What exactly is set as a value for client_id?

#

What does that environment variable resolve as?

slender thistle
#

It's not a yes/no question

earnest phoenix
slender thistle
#

Seems you actually can't, so let me rephrase it

rigid vale
slender thistle
#

What does os.getenv("sfgsfsd") return

slender thistle
earnest phoenix
slender thistle
#

As I don't remember

rigid vale
#

Ty

slender thistle
#

pain

#

Is that how you set your env var or do you just want to set your client_id to that ID

earnest phoenix
slender thistle
#

Then why do you use os.getenv

kind holly
#

I never prefer os thing...Easiest way is just make one py file and import from it...

slender thistle
#

I use JSON files with databases for everything

#

Easier to maintain and manage

earnest phoenix
#

guys how to handle DiscordAPIError: Unknown Message at RequestHandler.execute

kind holly
#

In regards of saving data yes i use Pgsql but for keys like token, db connection url i use py file

slender thistle
#

Try to fetch a known message

earnest phoenix
slender thistle
#

Aka the one that exists

earnest phoenix
#

I am mediocre

slender thistle
earnest phoenix
#

JS

kind holly
slender thistle
slender thistle
#

I'm just used to JSON files

earnest phoenix
slender thistle
#

And do you know how to set one?

earnest phoenix
slender thistle
#

How?

earnest phoenix
#

are you talking about setting the environmental variable for the system for using command in cmd

slender thistle
#

I'd say that's a good guess

fierce ether
#

can someone help im tryna make both text inline witht he image css <h3 class="cardtwo-title" >Astrah#2377</h3> <p class="cardtwo-role">Core Engineer</p> //css .avatar { width: 45px; height: 45px; border-radius: 50%; margin-right: 4%; display: inline-block; } .cardtwo-title { display: inline-block; font-size: 20px !important; color: #7289da !important; font-weight: bold; margin-top: 0; margin-right: 5%; margin-bottom: 30; } .cardtwo-role { display: inline-block; font-size: 15px !important; color: #7289da !important; font-weight: bold; margin-right: 50px; } //img <img src="../assets/imgs/astrahicon.jpg" alt="Avatar" class="avatar">

earnest phoenix
slender thistle
#

Well

#

Google shall help

manic sequoia
#

How to set our music bot deafen when joining a server?

earnest phoenix
manic sequoia
craggy pine
#

Yeah through code.

midnight brook
#

[discord.js] when i eval client i get service unavailable

#

anyone know why?

manic sequoia
earnest phoenix
#

varies from library to library

pale vessel
#

you okay?

proper heath
#

`const { prefix } = require('../config.json');
const Discord = require('discord.js');

module.exports = {
name: 'prune',
description: 'Prune up to 99 messages.',
aliases: '[p]',
execute(message, args) {
if(message.member.roles.find("name", "Helper")){
const amount = parseInt(args[0]) + 1;
if (isNaN(amount)) {
return message.reply('that doesn't seem to be a valid number.');

            } else if (amount <= 1 || amount > 100) {
                return message.reply('you need to input a number between 1 and 99.');
            }

        message.channel.bulkDelete(amount, true).catch(err => {
                console.error(err);
                message.channel.send('there was an error trying to prune messages in this channel!');
        });

    }else{
        message.channel.send(`Access Denied`);
    }

}};`

#

Anyone know the prefix?

#

I'm struggling

pale vessel
#

Use ```js

cinder patio
#

what do you mean by "know the prefix"?

proper heath
#

I'm trying to use the purge command

cinder patio
#

okay... what's wrong?

proper heath
#

I can't figure out the prefix

#

Or how to set one

#

const { prefix } = require('../config.json');

#

Has this got something to do with it

cinder patio
#

Why do you want to get the prefix it doesn't look like you are using it in the command

proper heath
#

Wym

rocky hearth
#

I think youhv copied the code from somewhere? right?

proper heath
#

Yeah

rocky hearth
#

And want to use this command

proper heath
#

Yeah

rocky hearth
#

😆

proper heath
#

Huh

rocky hearth
#

U need to open the file config.json, and see the prefix there!

proper heath
#

I'm new lol, how do I do that

#

Just got into this

#

Via the terminal?

fierce ether
#
.bar {
    height: 5px;
    background: crimson;
    text-align: right;
    p {
        color: white;
        font-size: 8px;
        padding-top: 5px;
        animation: fadeIn 5s;
      }
  }``` can someone help
cinder patio
#

no, you need to understand how the code works and implement it yourself. The code you copied uses a specific command handler.

fierce ether
fierce ether
#

to create bar

rustic nova
#

Where? context

#

loading bar?

cinder patio
#

I'm pretty sure you can't have nested rules in css

fierce ether
#

well it creates the bar

#

but after the bar is finished

#

i want the text to fade in

rustic nova
#

yeah like GoogleFeud said, you can't use nested rules

pale vessel
#

use .bar p

#

separately

fierce ether
#

thx

stuck pike
#

Any devlopers wanna work on a joint project?

#

Must know html stuff

pale vessel
#

ask somewhere else

earnest phoenix
clever vector
#

Anybody can teach me how to setup mongodb for d.js bot

summer torrent
earnest phoenix
#

i need help

honest perch
#

Ok

clever vector
#

I need to do is the Database

austere herald
#

I'm going to add my discord bot to top.gg but I don't know how to write the css code. If there is a css code that can change the background, would you assign it?

summer torrent
#

no

#

html/css is optional

austere herald
#

but I would be glad if you send it anyway

summer torrent
#

i won't spoonfeed you

austere herald
#

ok

carmine summit
#

@austere herald
body {
background-color: red;
}

delicate shore
#

Installing python to path

#

In Ubuntu

earnest phoenix
#

hi need help

#
        if (!message.mentions.users.size) {
            return message.channel.send(`Your avatar: <${message.author.displayAvatarURL({ format: "png", dynamic: true })}>`);
    }

    const avatarList = message.mentions.users.map(user => {
        return `${user.username}'s avatar: <${user.displayAvatarURL({ format: "png", dynamic: true })}>`;
    });

    message.channel.send(avatarList);```
#

when i execute this code

#

instead of avatar image it sends link of image

#

i want the image only

slender thistle
#

Either use embeds or fetch user avatars from the returned URLs and upload them

earnest phoenix
#

k

#

thanks

#

@slender thistle

pale vessel
#

you can't use an embed for multiple images

earnest phoenix
#

k

honest perch
pale vessel
#

Yes*

rocky hearth
#

any ts guy here??

summer torrent
#

yes

rocky hearth
#
class Square {
  piece: Piece | null;
  constructor(piece: Piece | null) {
    this.piece = piece;
  }
  
  get isEmpty() {
    return this.piece === null;
  }
}

const square = new Square(null);
if (!square.isEmpty) {
  square.piece.alliance;
}

How do I get my editor to not complain, about the square.piece to be null (empty)

summer torrent
#

not complain Thonk

#

maybe !square.piece

rocky hearth
summer torrent
#

can you show error

rocky hearth
#

yeah, but I have that getter to do the job

#

Error: Object is possibly 'null'.

cinder patio
#

You should directly do !square.piece

#

the typescript compiler isn't smart enough to recognize that the isEmpty getter checks if this.piece is null

summer torrent
#

try square.piece!.alliance (non-null assertion operator)

cinder patio
#

you can also do (square.piece as Piece).alliance

rocky hearth
cinder patio
#

(square.piece as Piece).alliance

rocky hearth
#

hmmm, but instead of this, I will go with non-null assertion operator. That's a bit more clean

summer torrent
#

🤔

cinder patio
#

but then you don't use the getter

rocky hearth
#

square.piece!.alliance; this removes the error

#

in the if block

eternal osprey
#

hey

#

this is occuring on my website

cinder patio
#

(square.piece as Piece).alliance this tells the TS compiler that square.piece is of type Piece so it should also remove the error

eternal osprey
#
 //Google Map
  var get_latitude = $('#google-map').data('52.379189');
  var get_longitude = $('#google-map').data('4.899431');

  function initialize_google_map() {
    var myLatlng = new google.maps.LatLng(get_latitude, get_longitude);
    var mapOptions = {
      zoom: 14,
      scrollwheel: false,
      center: myLatlng
    };
    var map = new google.maps.Map(document.getElementById('google-map'), mapOptions);
    var marker = new google.maps.Marker({
      position: myLatlng,
      map: map
    });
  }
  google.maps.event.addDomListener(window, 'load', initialize_google_map);```
rocky hearth
#

ts already knows, that my piece could be of type Piece or null

cinder patio
#

... no