#development

1 messages ยท Page 1518 of 1

mellow kelp
#

a tag

#

stands for anchor

drifting wedge
#

oh

#

mhm

#

im using a in the div tho

#

ill just use a div

#

gimme a min

mellow kelp
#

if you wrap the anchor tag around the div, the entire div should redirect you to the href

drifting wedge
#

mhm

vernal basin
#
  1. [object Promise]
  2. [object Promise]
  3. [object Promise]
  4. [object Promise]

uh wait I think it might not be working as i want it to be

#

oops

drifting wedge
#

removing the anchor from the text fucked it up doe

mellow kelp
#

then

#

how about using javascript

drifting wedge
#

mhm that would work

#

but then id need the pointer cursor?

mellow kelp
#

css

drifting wedge
#

i tried

#

it didnt work

mellow kelp
#

cursor: pointer

drifting wedge
#

ik

#

it didnt work

mellow kelp
#

o

opal plank
#

why

misty sigil
#

idk im basically writing code drunk at this point

opal plank
#

why not require all prefixes on startup?

#

dont you dare bad mouth drunk code

#

thats my motto, drink and code

drifting wedge
#

do pointer cursor work with divs?

misty sigil
#

if it works its nice

#

yes

drifting wedge
#

yes to what?

misty sigil
#

not to you

opal plank
misty sigil
#

fuck yea

opal plank
#

to save on database calls simply require all on startup and map them on redis

misty sigil
#

yea that might work

#

but i'll do that later

#

once this shit works

#

heY at least i amn't working on prod

opal plank
#

that sounded more personal than it should

mellow kelp
#

ah yes

misty sigil
#

๐Ÿ‘๏ธ

mellow kelp
#

"i'll do that later"

misty sigil
#

which means...

#

never.

mellow kelp
#

precisely

misty sigil
#

well, not never

#

i can already see a way to do it

#

i just need to make this work

drifting wedge
#

AHHH SOMEONE HELLLPP

#

how can i get 2 a tags

#

like one inside the other?

misty sigil
#

what

drifting wedge
#

or something to that affect?

misty sigil
#

why would you want that

drifting wedge
#

anchor tags

misty sigil
#

i know what an a tag is bro

drifting wedge
#

so im making like this button

#

and i need an href

#
                    <div class="col-xl-2 card1" style="float: left;">
                      <div style="padding: 10px; border-radius: 6px; display: flex; justify-content: center;" class="bg-dark">
                        <a style="color: #e0e0e0;" href="#">
                          <i class="fas fa-heart" style="color: #FF6B6B;"></i>
                          Support Us  
                        </a>
                      </div>
                    </div>```
#

but, i want the entire box to have an href

misty sigil
#

ooh flexbox

#

you could use js for that

#

iirc

mellow kelp
#

flexbox is life

misty sigil
#

^ that

#

i like jquery too

drifting wedge
#

wait wot

#

@misty sigil @mellow kelp

pale vessel
#

pong

misty sigil
#

piing

mellow kelp
#

pong

drifting wedge
#

wdym?

#

ik i can use js, but how would i trigger it?

mellow kelp
#

use the onclick event

drifting wedge
#

and id need the pointer to be a cursor

#

onclick of the div?

queen needle
#

have you ever looked in jquery it makes stuff like this easy or something

pale vessel
#

what are you even doing

mellow kelp
#

jquery isn't needed for this KEKW

misty sigil
#

jquery isn't needed for a lot of things

mellow kelp
#

its just a redirect

queen needle
#

i use jquery for everything ๐Ÿ‘€

misty sigil
#

i use it for some things

#

this has no backend

drifting wedge
#

where yould the onclick event be?

misty sigil
#

and returns a project by id

drifting wedge
#

like on the dib?

#

div*

#

i dont think u can

queen needle
pale vessel
#

why onclick

#

why not an a tag

misty sigil
#

document.getElementById('id').onClick(function(){}) or somethin idk

drifting wedge
#

im already using an a tag

pale vessel
#

huh

drifting wedge
#

like im already using it in the div

pale vessel
#

why do you need another one

drifting wedge
#

for an href

#

i need an href of the entire div

#

and if i do use js

#

i need cursor to be pointer

#

on div hover

misty sigil
pale vessel
#

just wrap it with an atag?

drifting wedge
#

im ALREADY USING AN A TAG

misty sigil
#

wrap it

drifting wedge
#
                      <div style="padding: 10px; border-radius: 6px; display: flex; justify-content: center;" class="bg-dark">
                        <a style="color: #e0e0e0;" href="#">
                          <i class="fas fa-heart" style="color: #FF6B6B;"></i>
                          Support Us  
                        </a>
                      </div>
                    </div>```
pale vessel
#

wrap it?

drifting wedge
#

if its not like this is looks bad

#

idk why

#

it looks wierd

pale vessel
#

why do you need js for this

drifting wedge
#

there we go

#

ty

misty sigil
#

back to callback hell i go

mellow kelp
#

sad promise noises

misty sigil
#

yea that might be easier

drifting wedge
#

how can i get these cards to like go to the next row?

#

so like,

--

--

instead of -- -- --

misty sigil
#
flex-direction: column;
```?
late spade
#

Im glad i code usind bdscript and not java or .js

drifting wedge
#

doesnt work

#

@misty sigil

#

can i do float left?

misty sigil
drifting wedge
#

like to basically be in the next thing

misty sigil
#

are those cards in a flexbox?

drifting wedge
#

now yes

sudden geyser
drifting wedge
earnest phoenix
#

no

#

flexbox is just "slang" for a div with display: flex

drifting wedge
#

can flex be in a anchor?

#

or just div?

earnest phoenix
#

you can make any element display as flex

mellow kelp
drifting wedge
#

mhm

earnest phoenix
#

play around with it

mellow kelp
#

some bot creation tool

earnest phoenix
#

with inspect element

drifting wedge
#

i usually use float left

#

to move it to a column

#

but its not working

earnest phoenix
#

flexbox for alignment is heaven

misty sigil
#

its fucking heaven ikr

mellow kelp
#

yes

#

headers have never been easier to make

misty sigil
#

just UGHHHHHHHHHHHH you type a few characters and shIT IS ALIGNED

#

how the fuck did i live without this shit

drifting wedge
#

pls help tho lmfao

#

how do i like move it

#

to a column

late spade
earnest phoenix
drifting wedge
#

ty

late spade
#

Ldyk

#

How do i get bot dev role?

mellow kelp
late spade
#

Oh be
T

lusty flume
#

I'm trying to use a command handler to make my command and one of my commands uses message.author.username but my console says TypeError: Cannot read property 'username' of null My modules are like these:


module.exports = {
    name: 'name',
    execute (message, args){
      //code here
      
    }
}```
misty sigil
earnest phoenix
#

microseconds

#

jesus thats fast

misty sigil
#

localhost ram db go BRRRRRRRR

drifting wedge
misty sigil
#

make width bigger

drifting wedge
#

i did

#

for the cards? or container?

mellow kelp
#

for the cards

#

i think?

#

use the inspect tool to check which one is limiting the width

drifting wedge
#

making the cards and the container width's bigger doesnt help

#

wait

#

i got it

#

ty

mellow kelp
#

noice

drifting wedge
#

ty guys :)))

mellow kelp
#

np

drifting wedge
#

is there a way to make the texts / icons all start at the same spot?

#

just margin lefts?

earnest phoenix
#

What's the vanity url ?

mellow kelp
#

pretty sure you can use text-align

mellow kelp
drifting wedge
earnest phoenix
#

I mean this server's vanity url

#

Dbl

#

Ok

mellow kelp
#

o

misty sigil
#

ok redis is poggers

#

wait no

#

its loggers

gilded olive
#

loggers and poggers

#

yea redis cool Allsmiles

vernal basin
#
data.games[index].deck = data.deck
#

will that make a shallow copy or a deep copy

crimson vapor
#

what is a shallow copy?

#

what is a deep copy?

tribal siren
#

can someone please give me a discord.js.org guild.channels.create file?

#

i can't find it

hollow sedge
drifting wedge
#

if i have an item that is position: absolute the scroll bar gets wonky

#

any fixes?

#

got it

stuck pike
#

Any idea for what's the best command handler?

jolly ether
#

anyone know how to host a bot 24/7 for free without it ever having to sleep?

lusty quest
lusty quest
jolly ether
#

sadly I don't have a credit card :.(

earnest phoenix
#

borrow your parents'

lusty quest
#

no one will give you Hardware entirely free

jolly ether
earnest phoenix
#

right?

jolly ether
#

yeah, let me actually try that rn

earnest phoenix
jolly ether
#

wait if its only free for one year or three months, how much do I pay after that?

earnest phoenix
#

as long as you don't enable billing on google, you're not paying.

jolly ether
#

hmm ok

vernal basin
#

so the console output is that strings[i] does indeed exist and it is exactly what i want, but here is what I am receiving from my bot:

#

any reason why this might be happening?

#

(please ping with response)

jolly ether
vernal basin
#

outside the scope

#

(same level as for loop)

jolly ether
#

can you send an ss of that?

vernal basin
#

ok

jolly ether
#

you should make your code async and then use await to make sure it runs step by step so you know for sure that the value has been defined before sending it

vernal basin
#

uh

#

how do i do that

jolly ether
#

ok so is that code part of a function?

vernal basin
#

nope

jolly ether
#

or part of a thing that says on.client or something

vernal basin
#

oh yeah

#

under this

jolly ether
#

ok add async to (message) so it looks like async (message)

vernal basin
#

okay

jolly ether
#

ok, now before adding anything else, in case that did it, try running it again

vernal basin
#

okay

#

that did not do it

jolly ether
#

ok, so for lines where you're assigning a value to strings add await to them

tardy hornet
#

Error: Cannot find module '/root/Among Us Bot/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node'

vernal basin
#

okay

jolly ether
#

so like if you're doing string[i] += 'whatever' just change it to string[i] += await 'whatever'

vernal basin
#

ok

lusty quest
#

did you moved the node_modules folder from a Windows PC on a Linux VPS?

jolly ether
#

ok so try running again after doing that

vernal basin
#

hm

#

still doesnt work

jolly ether
#

did you push the value to strings first?

#

after pushing a value to the array then you can add to it using [i]

#

so the first time you do it do strings.push("Your Cards:\n")

vernal basin
#

oh okay

jolly ether
#

can you add await to the front of strings.push

#

await strings.push

vernal basin
#

still nope

pale vessel
#

what

jolly ether
#

have you tried adding a value manually and checking?

#

like strings = ["test"]

tardy hornet
#

Error: Cannot find module '/root/Among Us Bot/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node'

lusty quest
tardy hornet
#

no

#

i even rebuild them

lusty quest
#

delete the entire folder and build them again

tardy hornet
#

i did

#

couple of times

vernal basin
#

when i started it as "test"

jolly ether
#

can you check your console?

#

I noticed you're logging it there

vernal basin
#

so it appears that strings[0] is test and the rest of the stuff is just getting appended yet not printed?

#

idk

jolly ether
#

can you try adding await to your for loops?

#

I think it was for await()

vernal basin
#

okay

#

that appears to be invalid syntax

#

both await for() and for await() dont work

jolly ether
#

maybe add await before the brackets?

vernal basin
#

also doesnt work

jolly ether
#

I have no idea then, sorry

vernal basin
#

okay, no problem

#

thank you for your time

restive furnace
#

for (await) iirc

vernal basin
pale vessel
#

for await

vernal basin
jolly ether
#

Argh so close

#

Glad you solved your problem

vernal basin
#
  else if (command == "start")
  {
    index = findGame(id);
    if (findHost(id) == -1) {message.channel.send("You aren't the host of a lobby."); return;}
    //if (data.games[index].numPlayers < 3) {message.channel.send("You need at least 3 players to begin."); return;}
    let x = shuffle(data.deck);
    let strings = [];
    for (i = 0 ; i < x.length; i++)
    {
      data.games[index].deck.push(x[i]);
    }
    for (i = 0; i < data.games[index].numPlayers; i++)
    {
      strings.push("Your Cards:\n");
      data.games[index].scores.push(0);
      data.games[index].hands.push([data.games[index].deck[0],data.games[index].deck[1],data.games[index].deck[2],data.games[index].deck[3],data.games[index].deck[4]]);
      data.games[index].deck.splice(0, 5);
      for (j = 0; j < 5; j++)
      {
        strings[i] += await `${j+1}. ${data.games[index].hands[i][j]}\n`;
      }
    }
    for(i = 0; i < 5; i++)
    {
      await message.guild.members.fetch(data.games[index].playerIDs[i]).then(val => val.send(strings[i] + "\n\nThe game will begin shortly."));
      console.log(i + ": " + strings[i] + "\n");
    }

  }

well unfortunately it appears there is another issue, the hands array in the json file is not updating

this is a yikes

#

I'm not entirely sure why, it was working a while ago

#

this time putting await in front of the data.games[index].hands.push([big spaghet mess]) line did not solve the issue

#

putting console.log immediately after shows that the array is what it should be

floral loom
#

hello gilicten coded bot bot. I got the startup file elsewhere does not work. Can you help me?

near stratus
#

what's the difference between
Discord.MessageEmbed() and Discord.RichEmbed() ?

true ravine
#

MessageEmbed replaced RichEmebed in djs v12 - any code you've written for RichEmbed will work fine for MessageEmbed, however there are a few minor changes you'll need to check the docs for

near stratus
#

oh thanks

#

I saw a code on GitHub and it said RichEmbed which I never heard of so I got confused

harsh blade
#

Hello!
How can i "load" a command?

lusty quest
#

so you want to split commands into individual files and then load them when the bot starts?

near stratus
ebon kelp
lusty quest
#

template bots bad

ebon kelp
#

:(

lusty quest
#

they invite users to just copy/paste the entire code without knowing what it does

ebon kelp
#

Thats true

#

But if you create new bots once in a while it's an easy start

near stratus
lusty quest
#

if i make a new bot i usually use one of my Existing bots as Template,

ebon kelp
#

That's also an option

harsh blade
ebon kelp
near stratus
#

COPYING is definitely not MAKING

ebon kelp
#

I know I know, but it's an easy for people who know what they're doing

lusty quest
#

they probably dont use then some random github template

ebon kelp
#

Probably not ppLaugh

#

Except me

near stratus
lusty quest
#

people who made already a few bots and have made themself an optimized template?

near stratus
#

You can't say if a GitHub code works or not
But repl codes, they're already working

near stratus
ebon kelp
#

Doubt

lusty quest
#

repl.it is an online code editor with direct hosting

ebon kelp
#

Ye, but why should anyone look there for templates?

near stratus
near stratus
lusty quest
#

you can also use VSC to code together

near stratus
#

yea

ebon kelp
#

Live share extension ye

near stratus
#

BTW are we forgetting GitHub ?

ebon kelp
#

Wat

lusty quest
#

why? i use it more for version control, and when working together it makes merging code easy

near stratus
#

Yea Git is mostly for saving your a** from the edit you made

#

but it's also used for coding together

zenith terrace
# ebon kelp Live share extension ye

you can use liveshare yea or create iirc some sort of ssh connection so you can work on the vsc project whenever without worrying about live share

lusty quest
#

you can use ssh to edit files directly on your VPS

zenith terrace
#

yea, cause I use ssh to help work on a bot with someone

ebon kelp
#

idk why would you put effort in that while there is an easy to use extension?

lusty quest
#

ssh is easy to setup?

ebon kelp
#

Liveshare

lusty quest
#

ssh is encrypted liveshare is not

#

atleast not on the same level

ebon kelp
#

Like if you're coding top secret code right now lol

lusty quest
#

its less bcs of informations more about intercepting the connection

zenith terrace
#

liveshare is bad if you wanna code the bot when the other user isnt available

ebon kelp
#

mhm

#

Used liveshare once, as I don't work together this way

near stratus
#

Anyway how do I set Avatar Quality in discord.js

#

like dimension

ebon kelp
#

Wdym?

#

Like someone send a file and you want to change the size?

lusty quest
#

i think you can force dimensions in px

near stratus
#

so I get a better quality

sacred aurora
#

give avatarURL() with an option

#

like .avatarURL({size: 1024})

#

i think that'll work

ebon kelp
#

Ye

#

If you want custon dimensions, you'll have to use a dependency

near stratus
ebon kelp
#

Quality is as good as the quality someone uploads it as (probably lower because of compression) You can't rely on getting hd pictures

zenith terrace
#

yea just depends on the quality of the original photo

ebon kelp
#

Just deal with it LULW

dense surge
#

Hi

eternal osprey
#

hey guys

#

(node:10824) UnhandledPromiseRejectionWarning: TypeError: spawns.includes is not a function

#

        currentMon = {};
        currentMon.id = Math.floor(Math.random() * Math.floor(dex.length)) + 1;
        currentMon.name = dex[foundst];
        currentMon.level = Math.floor(Math.random() * Math.floor(100)) + 1;
        currentMon.catchChance = (pConfig.catchDifficulty/currentMon.level);
        currentMon.spawnId = Math.floor(Math.random() * Math.floor(9999999-999999)) + 999999;
        while (spawns.includes(currentMon.spawnId)){
            currentMon.spawnId = Math.floor(Math.random() * Math.floor(9999999-999999)) + 999999;
        }
        spawns.push(currentMon.spawnId);
        updatePoke();
    
        if (Math.random() < pConfig.shinyChance){```
cinder patio
#

how do you define spawns

delicate shore
#

Ok hey there guys

#

I have a problem

silver lintel
#

Hi pgamerx

earnest phoenix
#

hi how do i create a slowmode command

#

it saya

#

says error

pure lion
#

how can i make my bot have a lower ws/message latency

lusty quest
#

this is actually decent

#

you could get lower if you find a Host that is in the same datacenter where discord is

pure lion
#

i mean i got it down to

#

then i installed the packages tim recommended to install with discord.js light and now its slow

honest perch
#

Dice check palace

pure lion
tired panther
#
 let msg = await client.guilds.cache.get("777458791796703262").channels.cache.get("777458792958787590").send({    embed: report,}).catch((error)=> {message.channel.send("Error happend! ,Pls try again later or join our support server")});
``` why is msg undefined?
pure lion
#

you're defining msg and trying to reference it in itself

#

or it cant get the guild/channel

tired panther
pure lion
#

then maybe they're not cached

tired panther
#

caching is on

pure lion
#

also client.channels.cache is a thing

#

just because caching is on doesnt mean everything is cached

lusty quest
#

get a closer location to discords api / Gateway Servers

tired panther
#

mines is 200 ms

#

xD

quartz kindle
#

the only way to improve api ping is to move closer to the gateway

#

get a vps located in new york

#

message latency is pretty much the lowest you can get already

pale vessel
#

move to new york and selfhost BigBrain

quartz kindle
#

only if you have really good fiber xd

pure lion
quartz kindle
#

get a vps located in new york

#

lmao

pure lion
#

the only options my host gives me is canada or france

#

oh well

dusky sundial
#

Change host smile

pure lion
#

no ๐Ÿ˜„

delicate shore
#

I need help

#
                    for (i = 0; i < predictions.length; i++) {
                        console.log(optionsboi)
                        console.log(probboi)
                        if (predictions[i].probability > probboi) {
                            if (optionsboi.includes(predictions[i].className)) {
                                msg.delete()
                            }
                        }
                    }

This is my code
Bot doesn't delete the message

#

This is predictions

[
  { className: 'Neutral', probability: 0.9956157207489014 },
  { className: 'Drawing', probability: 0.004245242103934288 },
  { className: 'Hentai', probability: 0.0001161084437626414 },
  { className: 'Porn', probability: 0.000020942647097399458 },
  { className: 'Sexy', probability: 7.311034551094053e-7 }
]
#

This is optionsboi

["Sexy"]
#

This is probboi

0.7
#

Why doesn't Bot delete the message

pale vessel
#

Sexy xqclewd

delicate shore
#

lol

#

But why doesn't it

pure lion
#

what's probBoi

delicate shore
pale vessel
#

Does it have perms?

delicate shore
#

Ys

#

Admin perm

pale vessel
#

Log everything console.log(predictions[i].probability > probboi, optionsboi.includes(predictions[i].className))

quartz kindle
#

it does not delete because it doesnt pass the ifs

pale vessel
#

by the way you should use && instead of chaining it like that

delicate shore
#

but why , that's what I don't get

pale vessel
#

makes the code hard to read

#

Debug

quartz kindle
#

only Neutral passes the first if, and only Sexy can pass the second if

delicate shore
#

But isn't
7. > 0.7

quartz kindle
#

the probability of Sexy is not 7.3, its 7.3e-7

#

which is 0.0000007311034551094053

delicate shore
#

ohh

lusty quest
#

maybe round the numbers to 4-6 digits after 0

zenith terrace
#

owo

zenith terrace
pale vessel
#

no u

quartz kindle
#

owo

zenith terrace
tribal siren
#
const member = message.mentions.members.first()
member.setChannel(null)```
#

why doesn't this work?

earnest phoenix
#

you tell me

zenith terrace
#

hey cry, how you doin

earnest phoenix
#

๐Ÿ‘‹ im tired

#

wbu

tribal siren
#

yes sup cry, stargirl, flazepe and tim

zenith terrace
#

bored rn in online class

earnest phoenix
#

i just browsed the docs, there is no setChannel method on a member

#

theres edit

#

you're probably looking for that

tribal siren
earnest phoenix
#

yeah you can do that with edit

tribal siren
#

so uh

#

member.edit({channel: null}, 'Reason')?

earnest phoenix
#

should work

#

tias

tribal siren
#

let's test i guess

#

yay it worked

#

ty <3

pale vessel
delicate shore
#

How to round off numbers in js

quartz kindle
#

Math.floor(n), Math.ceil(n), Math.round(n), parseInt(n), n.toFixed()...

#

all of those can be used for rounding

delicate shore
#

Oh

quartz kindle
#

i used toFixed for that

#

but keep in mind that toFixed converts the number to a string

delicate shore
#

Ah alr

#

I can use parseInt then

#

On the string

quartz kindle
#

if the string has decimals, use parseFloat

delicate shore
#

Alright thanks tim

eternal osprey
#

hey

#

why is my queue embed not changing the time?

#

look at my code:

sick fable
#

'Client' has no attribute to 'command'

#

how to fix mine?

eternal osprey
#
if (command === 'queue' && subcommand === 'join') {
    
    if (queueMessageId === 0) {
      message.channel.send('A queue does not currently exist trainer '+ "<@" + message.author.id + ">");
      
    } else {
      message.channel.messages.fetch(queueMessageId).then(queueMessage => {
        if (addUserToQueue(message.member.displayName, message.member.id, test)) {
          assembleQueueMessage();
          const userQueueDuration = timeInQueue(message.member.id);
          queueMessageText += ' ' + message.content.slice(Config.prefix.length).replace(/^queue *join/, '').trim()
          timesss = userQueueDuration;
          
          setInterval(async () => {
          if (Config.useEmbeds) {
            
            timesss = userQueueDuration;
            if (typeof userQueueDuration === 'string' || userQueueDuration instanceof String) {
              let z = userQueueDuration;
            
           
            queueMessage.edit(embedQueue.setDescription(queueMessageText + z));
          } else {
            queueMessage.edit(queueMessageText + z);
          } }}, 10000);
        } else {
          message.channel.send(`${message.author} already entered the list queue!`);
        }
      })
        .catch(console.error);
    }
  }```
#

is it maybe because i have to use the command queue join?

earnest phoenix
sick fable
earnest phoenix
#

are you new to python

sick fable
#

i just dont know how to fix it

earnest phoenix
#

rtfd

delicate shore
#

But @quartz kindle if it's 0.49373736 it returns 0
Isn't there any way that I can round it off to 0.5

#

Like any method

sick fable
#
from discord.ext import commands

bot = commands.Bot(command_prefix = "$")```
#

this is my code

#

and i didnt gave the command

#

hol up

#
from discord.ext import commands

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


@bot.event
async def on_ready():
	print('Online!')
	

swear = [ ]

@bot.commmand()
async def banword(ctx , *, word = None):
		swear.append(word)
		
@bot.event
async def on_message(message):
	if message.content.startswith == word:
		await message.delete()
		
	



bot.run(token)```
#

^^

#

thats all

earnest phoenix
#

what's the error

sick fable
#

'Bot' object has no attribute 'commmand'

#

@earnest phoenix

slender thistle
#

two m's

#

not three

#

the logic is flawed also

#

str.startswith is a function

crystal wigeon
#

well, im proud to announce my bot hit 250 guilds uwu and almost 1k players now

slender thistle
#

You want the in operator and str.lower()

earnest phoenix
#

word isn't even defined kekw

crystal wigeon
#

Thank you guys so much for helping when i had issues ๐Ÿ˜„

sick fable
#

fixed

#

but i am still getting the same error

slender thistle
#

two m's
not three

#

command not commmand

sick fable
#

lmao its done

#

worked โค๏ธ

#

thanks

#

@slender thistle i got another error lmfao

#

i want to make it like if the message content is in the list. It will automatically delete.

async def on_message(message):
	if message.content.startswith == (str(word)):
		await message.delete()```
earnest phoenix
#

word isn't even defined kekw

#

you're changing nothing that shiv has mentioned doe

slender thistle
#

you daft f c i h y

#

eghm

tame meteor
#

hello

sick fable
#

bol

sick fable
tame meteor
#

i would like to know how to make commands

sick fable
#

I am like doing a lot of things at the same time

tame meteor
earnest phoenix
#

So you lied about you're not new to python? MegaThonk

sick fable
tame meteor
sick fable
tame meteor
#

can anyoe tell me how to make commands

#

of bots

sick fable
#

i cant just understand it lmfao

earnest phoenix
#

You're not showing that though

quartz kindle
#

do you have any experience with programming/coding? @tame meteor

quartz kindle
#

creating a bot requires knowing how to code

tame meteor
delicate shore
#

Ah alr
Thanks Tim
I didn't put 1 in the ()

tame meteor
delicate shore
#

I'll put 2
That will be good

#

So I get 0.52

#

Or smth

sick fable
#

it worked lol @earnest phoenix

#

the word wasnt defined

sick fable
earnest phoenix
#

I have no clue how is a function equal to str, but okay.

tame meteor
sick fable
#

fuck man

lusty quest
lament rock
#

Function.toString() :)

sick fable
#

next thing.

#

My bot is not replying again

#

no errors too

slender thistle
#

Fucking Christ batshit nurse mermaid clusterfuck

#

startswith is a function

tame meteor
#

@earnest phoenix can i dm you??

earnest phoenix
#

regarding what

tame meteor
#

python and making process of commands of bot

earnest phoenix
#

if you're at least familiar with python, sure. Otherwise no

tame meteor
sick fable
#

๐Ÿ˜ญ๐Ÿ˜ญ

#

i got another problem

#

finally everythings fixed

earnest phoenix
#
    setInterval(() => {
        dbl.postStats(client.guilds.cache.size, client.shards.ids, client.shards.total);
    }, 1800000);
});``` thats true?
delicate shore
#

An npm package

lusty quest
#

ok

#

i started to use tensorflow and do some text classification

delicate shore
#

Nicee

#

Nsfwjs also uses tensorflow

lament rock
#

automatic image object recognition isn't good enough to be a line between what is nsfw and isn't if you're showing users images classified automatically.

trail edge
#

who knows how use mongodb?

green kestrel
#

many people

lusty quest
#

someone here with an idea why this call wont increase the value in the db?js member.update({ memberID: uid }, { $inc: { warnings: 1 } }); member is a valid MongoDB document

#

uid also exist in the database.

summer torrent
#

make sure your variables are correct

earnest phoenix
#

How do I make a bot?

delicate shore
#

First choose a language you wanna code in

#

Most of users stat with python or JavaScript

#

I started with JavaScript

#

JavaScript is faster but python is easier as it has no syntax issues

earnest phoenix
#

O.o

#

the last one is definitely not true

delicate shore
#

Why

earnest phoenix
#

they're both pretty much equivalent in speed

#

wdym by no syntax issues

#

if anything, py would be faster because out of the box threading

lament rock
#

Python and JavaScript both have their own use cases with performance being dependent on the work load type

delicate shore
#

I read an article and it suggests that js is faster

lament rock
#

Don't trust everything you read online

#

Python is much preferable for Math related work loads which makes it popular for AIML

#

Good luck doing that in Js HideThePain

delicate shore
lament rock
#

note how it's all prefaced with "web programming"

#

A server sided environment is usually best done in JS

delicate shore
#

I c

lament rock
#

Needless to say a server could do anything and it's possible a web server implements the use of multiple languages where another language acts as a worker

delicate shore
#

I'm considering learning py

#

Is the change worth it

lament rock
#

It depends on your use case. If you are not going to get into AIML, the answer is usually no. If you want to learn it just to know it, there's nothing stopping you.

opal plank
#

from a lot of people i know that uses/used both (and some other langs), the usually consensus i hear is that py is only good for arduinos n shit KekDoggo @slender thistle prove them wrong

delicate shore
#

Alr thanks

slender thistle
#

For Arduinos you'd very possibly use Arduino IDE

#

Python is more for data science/machine learning

tribal siren
#
if(oldState.channelID != newState.channelID){
    if(oldState.channel.parentID === '798413426086510673' || oldState.channel.parentID === '736472475625324568'){
      let host = await db.get(`host_${oldState.channelID}`);
      if(newState.id == host){
        oldState.channel.delete()
        await db.delete(`host_${oldState.channelID}`);
      }
      else return;
    }
    else return;
  }```
#

it says cannot read property 'parentID' of null

#

what should i do?

opal plank
slender thistle
#

It is a language

opal plank
#

oh thats interesting

slender thistle
#

Arduino language is similar to C

cinder patio
#

Realistically you can run any programming language on an arduino

opal plank
#

well at least py isnt bloated with shitty 2 line packages that are downloaded by 300k users like is-odd mmulu

slender thistle
tribal siren
#

i did

#

tons of times

opal plank
quartz kindle
opal plank
#

its literally 1 line

earnest phoenix
#

if i want a fruit, and i don't want it to be an apple, what would i do so i don't eat an apple?

opal plank
#

(num % 2) === -1

summer torrent
#

user connected/disconnected from voice channel, thats why

earnest phoenix
#

yes, the same way here you need to check for null

#

if it's null

#

you cannot use it

#

the user wasn't in a voice channel

tribal siren
#

he really wasn't

#

it's for when someone joins a vc

#

oh damn tf it's oldState

#

im blind

quartz kindle
#

oldState is the users voiceState before the update

tribal siren
#

yes i got it

#

now i got this code

#
if(oldState.channelID != newState.channelID){
    if(newState.channel.parentID === '798413426086510673' || newState.channel.parentID === '736472475625324568'){
      let host = await db.get(`host_${oldState.channelID}`);
      if(newState.id == host){
        oldState.channel.delete()
        await db.delete(`host_${oldState.channelID}`);
      }
      else return;
    }
    else return;
  }```
#

it still shows the same error

earnest phoenix
#

you're still using oldState in your code

#

and not checking if the channel is not null before using it

tribal siren
#

oh wait that's for disconnecting

quartz kindle
#

if the user leaves the voice channel, then newState will not have a channel either

tribal siren
#

so that's why it's null

#

wait i got an idea

#
if(oldState.channelID != newState.channelID){
    if(oldState.channelID){
      if(oldState.channel.parentID === '798413426086510673' || oldState.channel.parentID === '736472475625324568'){
        let host = await db.get(`host_${oldState.channelID}`);
        if(newState.id == host){
          oldState.channel.delete()
          await db.delete(`host_${oldState.channelID}`);
        }
        else return;
      }
      else return;
    }
  }```
#

here

#

probably should work

earnest phoenix
#

fresh join: old state channel null, new state channel defined
channel switch: both channels are defined
channel disconnect: old state channel defined, new state channel null

tribal siren
#

yay now it works

#

thanks

stable eagle
#

Is there a way to make a mongodb document delete itself after a given time?

stable eagle
#

Thanks

sudden geyser
clever chasm
#

i have no clue what happened but my bot said screw it il work again

#

so i think its ok

gilded olive
#

Trying to install 1.5 on py 3.9?

pale vessel
#

already person with ganyu pfp, love it

frail holly
#

Is authentication even required to get guild info by id?

#

not members, channels, etc. Just guild info

mellow kelp
#

you have to authorize the request with an oauth2 bearer token

opal plank
frail holly
#

So would the token need to be for example... a token of the owner of the guild for instance?

pale vessel
#

what server you playing?

frail holly
#

Because even with an oauth2 token and bearer I cant get this information

opal plank
pale vessel
#

aah

#

yeah I barely play genshin anymore KEKW

opal plank
#

well if you do, shameless plug, i got her chaarcter build in meh bot

#

i need to schedule another scrape unit

frail holly
mellow kelp
#

it's Bearer <token>

frail holly
#

Idk just really not sure. The token is valid, and has guilds in scope

earnest phoenix
#

you can't use a bearer token for that endpoint

mellow kelp
#

o

frail holly
#

What is the auth type then?

#

Any auth I try is returning 401

earnest phoenix
#

a bot token

mellow kelp
#

shouldn't it be possible with a bearer token too

earnest phoenix
#

no

frail holly
#

And I assume the bot must be present in the server?

earnest phoenix
#

correct

#

however you're probably looking for this endpoint

frail holly
#

No. Im not.

earnest phoenix
#

oh

#

then you will have to use a bot token

#

with the bot being in the guild

frail holly
#

I want to get guild data by ID only. Not for specific user.
This is for a website.

lusty quest
#

V6 is deprecated

frail holly
#

But if a bot is required then so be it.

lusty quest
#

use V8

#

also the API will only send the first 100 Guilds, if you want all use Websocket

wicked pivot
#

how to get the list of guilds with which my bot has the "send_messages" permission?

lusty quest
#

get all guilds and then check the bitfield for the send_messages permission

mellow kelp
#

get the bot guilds list and filter it out

lusty quest
#

(filter them out of the manager)

earnest phoenix
lusty quest
#

ok

earnest phoenix
#

you'll get a REST guild entity with their endpoint

#

just with some data missing

frail holly
#

I might just skip the way I was thinking about doing it then.
With a bot using a wrapper I can get all of this data significantly easier than with a REST call. And setup services to constantly update the guild data in my database.

#

Cool beans. Thisll work great actually.

wicked pivot
#

(node:31272) UnhandledPromiseRejectionWarning: TypeError: r.me.permissions is not a function

#
bot.guilds.cache
.map(r => {
        if(r.me.permissions('SEND_MESSAGES')) console.log(r.name)
    })```
summer torrent
#

permissions.has()

#

permissions is collection iirc

misty sigil
#

@wicked pivot

wicked pivot
#

oh yes i'm stupid sorry

unique mulch
#

I just have a question - if I'm waiting for my bot to get approved, can I make an invite command? If so, where do I get the link?

summer torrent
solemn latch
#

Bot development doesn't start with top.gg.
You can make an invite command without ever posting your bot to top.gg

unique mulch
#

thank you

earnest phoenix
#

what's a REST API

restive furnace
#

@earnest phoenix HTTP(S) API

summer torrent
#

REpresentational State Transfer

earnest phoenix
#

so its basically an api where stuff goes over the air through http

summer torrent
#

api which using rest architectural style

rare sierra
#

We need to break it up.

sudden geyser
#

always has been

solemn latch
#

Does that mean I have to choose between dsl and the bot list

#

Oh no its like choosing mom or dad all over again

fast trench
#

How would I define a user? I am making a bug report message event. I want to be able to send 2 of the developers for the bot dm's with the bug reports when made...

fluid basin
#

you get or fetch a user

sudden geyser
#

Get the message instance tied to the event?

#

You at least need the ID of the user

fast trench
#

they might not be in the same guild as the bot either so I can't do message.guild.members

gilded olive
#

they have to be in a guild with the bot to dm afaik

solemn latch
#

^ yes but not the same as the message originates from

#

Since its developers I assume they are in atleast one server with the bot.

fast trench
#

also shouldn't client.members work?

solemn latch
#

I would use client.users personally since you are just using it for a dm.

#

I also would use fetch

#

Not get

eternal osprey
#

hey

#

"spawnChannel": "798261704071970837",how do i select a random channel from the json file?

long marsh
earnest phoenix
#

realistically speaking

#

99.9% of your user cache are members anyways

vernal basin
#

index

eternal osprey
#

in the config file

vernal basin
#

not sure what you're trying to do, there's only 1 value so any random generation would pick that value

eternal osprey
#

i am trying to randomize these channels to eventually get 1

drowsy grail
#

yea what relay said

drowsy grail
# eternal osprey

object.spawnChannel[Math.floor(Math.random()*object.spawnChannel.length)] will give you a random item in the array

#

just replace "object" with the name of your object

eternal osprey
#

and i would have to assign it a variable to call it.

#

thanks

drowsy grail
#

you can import a json file to a js file with require()

#

no problem

fervent goblet
#

is there a way to prevent one ctx.clip() from hiding another? im using canvas with discord.js

#

when i do this it deletes the progress bar

quartz kindle
#

why do you want to clip again?

eternal osprey
#

in my case it would be spawnChannel1 right as that is the object in the json file containing the channels.

fervent goblet
quartz kindle
#

idk what you mean by that, but the clip method uses the last path you created

#

and always applies to the entire canvas

fervent goblet
eternal osprey
#
 "spawnChannel1": ["798261704071970837", "795941685690368021", "761256089131548692"],```hey how do i randomize the channel?
#

i want to select 1 channel, with a randomizer

quartz kindle
#

where is the glitch?

fervent goblet
opal plank
#

hmmm is it possible to see how many people are following an announcements channel ?

solemn latch
opal plank
lusty quest
quartz kindle
# fervent goblet

that looks like you're doing something wrong when drawing, not something you'd want to fix with clip

eternal osprey
#

still at the json dbs yeah

drowsy grail
lusty quest
#

if you got an array you can use the randomizer code someone else sended in earlyer

fervent goblet
#

my solution was to add a clip over it to prevent that from showing

#

i have an idea now

eternal osprey
#

let me try it again

drowsy grail
#

@eternal osprey try starting the path to the file with './'

eternal osprey
#

const file = require("./pokemon_config.json") this is what i did before

eternal osprey
drowsy grail
#

oke

eternal osprey
#
let spawnChannel = object.spawnChannel1[Math.floor(Math.random()*object.spawnChannel1.length)]```but why is there spawnChannel1 right there?
drowsy grail
#

you can access the array with file.spawnChannel1

eternal osprey
#

aha okay

#

i get it

drowsy grail
#

because thats the name of the array

#

yee replace "object" with "file"

eternal osprey
#

yeah i get it

distant cobalt
earnest phoenix
#

That means dbl.webhook is undefined, what's dbl defined as

distant cobalt
#

dbl i defined as...

solemn latch
#

you need to have the port and auth defined in the initialization of it.

#

otherwise the webhook is never enabled

#

also, that library is deprecated

distant cobalt
#
const dbl = new DBL('No taking my token', client);```
earnest phoenix
#

Instead of using dblapi.js, use @top-gg/sdk

distant cobalt
#

oki

quartz kindle
#

webhook is only available if you actually setup a webhook

distant cobalt
#

how do i setup a webhook

solemn latch
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
see how here the port and auth are set.

quartz kindle
#

new DBL('No taking my token', { webhookPort: YOURWEBHOOKPORTHERE, webhookAuth: "bla" }, client);

distant cobalt
#

k

#

what do i put for my webhook url?

earnest phoenix
#

http://<Your IP>:<Your port>/dblwehook for example

distant cobalt
#

ok

#

what do i put as my IP?

earnest phoenix
#

Your IP?

distant cobalt
#

Yeah

#

what do i put in <Your IP>

earnest phoenix
#

Just put your IP monbreyFacepalm

distant cobalt
solemn latch
earnest phoenix
#

Top.gg IP? Your local IP address

distant cobalt
#

where do i get my local IP address?

earnest phoenix
#

Google

solemn latch
#

if you are hosting on a VPS, the ip you use to connect to that vps

#

if you are hosting at home, google "whats my ip" it will tell you.

#

make sure to disable any vpns first

distant cobalt
dusky sundial
#

You won't find your router IP in cmd

distant cobalt
#

o

#

is there a link?

#

you can send me

dusky sundial
distant cobalt
#

okay

dusky sundial
#

for instance

glad violet
#
I WANT HELP WITH MY MUSIC BOT NOW NOBODY HELPS ME :cry:
dusky sundial
#

or just google "what is my IP"

distant cobalt
#

is it the ip under this thing?

dusky sundial
#

Yes

lusty quest
#

also whattfismyip is a thing

glad violet
#

i will send the code here

distant cobalt
#

oki

glad violet
#

problem = disconnect command sends message leaving but not leaving voice

distant cobalt
#

what's my port?

#

http://my ip:<Your port>/dblwehook

lusty quest
glad violet
#

case 'stop':
var server = servers[message.guild.id];
if(message.guild.voice.connection){
for(var i = server.queue.length -1; i >=0; i--){
server.queue.splice(i, 1);
}
if(server.dispatcher) server.dispatcher.end();
message.channel.send("Leaving...")
console.log('Leaved Succes')

             }
             
             if(message.guild.connection) message.guild.voice.connection.disconnect();
          break;
solemn latch
glad violet
earnest phoenix
#

Oh my god, this guy is using an array for music system

earnest phoenix
#

At least use a Map

distant cobalt
pale vessel
#

๐Ÿ—บ๏ธ

solemn latch
distant cobalt
#

...

dusky sundial
#

Just use any port that isn't already being used by another service

quartz kindle
distant cobalt
quartz kindle
#

is it a full vps?

#

or one of those "discord bot hosting" things

dusky sundial
distant cobalt
quartz kindle
#

so its not a full vps

distant cobalt
#

no

#

i don't think so

#

wait view it here

solemn latch
#

I really need to make one of these bot hosting platforms, these guys make bank.

#

for zero effort

distant cobalt
#

lol

quartz kindle
#

in a full vps, you can use any port from 1024 to 64k, as long as there is no other process using that port

#

you can try doing that as well and see if it works

earnest pollen
#

s/help

earnest phoenix
lusty quest
#

rent a cheap Root Server and then just run something like petrodactyl and give each customer a Docker Container. (its not even a joke met someone here who used such a hoster)

quartz kindle
#

if it doesnt work, your host might be limiting what ports are available for you, in which case you need to ask them

pale vessel
#

6969

distant cobalt
#

like tell me one to use

distant cobalt
#

so i tested it

solemn latch
#

did you use the ip of your bot host?

#

not your home ip

earnest phoenix
#

Testing it sends a payload to the webhook to log something to see if it works, set it up first

distant cobalt
distant cobalt
#

using ipchicken

solemn latch
#

yeah

#

you need to use the ip the host of your bot gave you

#

or should have given you

distant cobalt
#

I'll ask them

glad violet
#

let me test

dusky sundial
#

mariadb.InterfaceError: MySQL server has gone
anyone know how to fix this?

quartz kindle
#

maria dumped you and left

dusky sundial
#

Come back Maria

#

I miss you

distant cobalt
#

i got it

#

lol

#

nothing else happens

glad violet
#

@dusky sundial WITH THAT COMMAND IT CRASHED MY BOT NOW BRUH

distant cobalt
#

..

dusky sundial
#

Any error messages?

glad violet
#

no it just closes cmd

#
            case 'stop':
                  var server = servers[message.guild.id];
                  if(message.guild.voice.connection){
                      for(var i = server.queue.length -1; i >=0; i--){
                          server.queue.splice(i, 1);
                 } 
               if(server.dispatcher) server.dispatcher.end();
               message.channel.send("Leaving...")
                      console.log('Leaved Succes')

                 }
                 
                 if(message.guild.connection) message.guild.voice.connection.disconnect();
                 voiceChannel.leave();
              break;
#

can u fix it @dusky sundial

#

ping me if fixed

earnest phoenix
#

Hiii

glad violet
#

or someone fix it and ping me

dusky sundial
#

Well I'm not gonna write the command for ya, pretty sure @earnest phoenix gave you a solution above as well

glad violet
#

AND DO NOT TALK ABOUT server.dispatcher
i used a variable

earnest phoenix
#

@dusky sundial

#

Can you help me make a bot?

#

*show me

dusky sundial
#

What do you need help with?

#

I'm not a teacher, sorry

earnest phoenix
#

Ohh ok

glad violet
#

@dusky sundial if u fix my code send it in my dms ok?

dusky sundial
#

Not a js dev, so I won't fix much

glad violet
#

...

#

is someone a js dev ?

#

oh i think u send me outated commands

solemn latch
#

lots are, but most of us wont fix your code for you.

#

we can help you understand how to fix it.

distant cobalt
#

Uhh when i voted for my bot the console doesn't say i voted

glad violet
#

i think voiceChannel Is voice.channel now

lusty quest
#

i make large circles around Music bots

dusky sundial
#

Music bots can be a good practice project, but I wouldn't bet on them ever becoming popular

#

And they're not too much of a practice if you don't understand what you're doing

solemn latch
#

also get expensive if they do grow at all

dusky sundial
#

^^

long marsh
#

Yay! Discord has an incredibly fast turnaround time. My bot verification was approved in under 24 hours.

solemn latch
#

they finally caught up i guess

glad violet
#

@dusky sundial
crashes with this log

ReferenceError: voice is not defined
    at Client.<anonymous> (C:\Users\katte\Desktop\Music Bot\index.js:94:18)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\katte\Desktop\Music Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\katte\Desktop\Music Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\katte\Desktop\Music Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\katte\Desktop\Music Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\katte\Desktop\Music Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\katte\Desktop\Music Bot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\katte\Desktop\Music Bot\node_modules\ws\lib\websocket.js:800:20)
dusky sundial
#

so then message.guild doesn't have anything called voice is what I take from that

distant cobalt
long marsh
glad violet
#

ok its better

#

now bot leaves the channel but node shows an error

(node:7580) UnhandledPromiseRejectionWarning: #<ErrorEvent>
(Use `node --trace-warnings ...` to show where the warning was created)
(node:7580) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7580) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

#

should i type .catch console.log()

dusky sundial
#

You can try

glad violet
#

no need i just restarted the bot and no more errors ๐Ÿ˜„

distant cobalt
glad violet
#

also how to make my bot searchs with youtube-search-api and no with no link or video id

sturdy dock
#

Is there any way for shards of a bot to share variables? like modify and read from the same int/string/array

#

using discord.js

solemn latch
#

if i remember the conversation well enough yesterday, yes, but its pretty complex.

#

pretty sure youd be implementing it mostly by hand.

dusky sundial
#

Idk if it'd work but maybe use a redis database to store the variable values.

solemn latch
#

^ look into that

sturdy dock
#

hmm, if its that complex i think i'll just use a mysql database

#

thanks for the help

buoyant aspen
#

Is it possible to preload something using the css src:url() property? (Like <link rel="preload"..., but for CSS)

earnest pollen
sinful elk
#

why would you send an invite link to a server INSIDE THAT SERVER

sturdy dock
#

what's the ~max amount of guilds before you need to shard?

earnest phoenix
#

2500

sturdy dock
#

also is it mainly due to having to cache too many guilds or just the sheer amt of messages being processed

earnest phoenix
#

it's because that's too much data to send over a single connection