#development

1 messages · Page 1436 of 1

lusty quest
#

i thought you where talking about one in a Industrial Use case. (like feeding a robot)

umbral zealot
#

That's gonna take a lot of JavaScript and some requestAnimationFrame magic 😊

earnest phoenix
#

damn i forgot to feed my robot again

#

😂

#

@earnest phoenix why?

#

can't tell if we found modern day socrates or, well, yk

#

@umbral zealot without canvas

drifting wedge
#

wat theme

wanton pecan
#

Hello

earnest phoenix
drifting wedge
#

"Hello"

earnest phoenix
#

"Hello" in Chat.

drifting wedge
earnest phoenix
#

"Hello" in Chat.

urban vapor
#

hello

earnest phoenix
#

@drifting wedge hello what's up 👋🏻

drifting wedge
#

hey!

hollow sedge
quartz kindle
#

Why do it with canvas?

cinder sandal
#

it's the license for the software

knotty obsidian
#

why doesnt this work

event.getJDA().getStatus().equals(OnlineStatus.ONLINE);
event.getJDA().getStatus().equals(Activity.playing("Terraria"));
earnest phoenix
#

what doesn't work

knotty obsidian
#

the two lines

#

the status doesnt get set

#

it just stays "Booting up..."

earnest phoenix
#

well you aren't setting it anywhere

earnest phoenix
#

you're comparing

#

not setting

knotty obsidian
#

how do i set

earnest phoenix
#

do you even know java

knotty obsidian
#

yes i know

#

how do i set it then

earnest phoenix
#

then you'd know what equals is used for

#

go learn java

knotty obsidian
#

👏

#

server helped me yay

#

now i can continue my journey of learning java

#

and making bots

#

because they helped me get past this barrier

#

thanks so muh

unborn crow
# knotty obsidian how do i set
event.getJDA().getPresence().setActivity(activity);```

same goes for onlinestatus just use setStatus instead of setActivity.
quartz kindle
#

Imagine a library that sets status using getStatus() and gets using setStatus()

earnest phoenix
#

Hello how we make for that the profile of the bot floats?

#

print it on a piece of paper, glue it to a plastic container and flip the container upside down

#

it's floating in water!

#

😂 But I get not ask that

#

i know

crimson vapor
#

yes imagine a lib that uses a getter as a setter and a setter as a getter

earnest phoenix
#

i was kidding with you because you need to give more context with your question

umbral zealot
#

I've no idea what "Floats" means either

#

making the boat float sounds like a new meme level.

quartz kindle
#

He wants a floating animation in top.gg

rustic nova
#

@sweet ravine the selector for the stars is .entity-header__star.star.icon

crimson vapor
#

from what I can tell they are cooler integers but not quite as cool as doubles

umbral zealot
#

How'd you get "Animation" from that? lol.

rustic nova
umbral zealot
#

Because I just went float: left , y'know?

quartz kindle
#

"the profile of the bot floats" most likely they mean a floating effect animation where the image slowly goes up and down

crimson vapor
#

wait are we talking about floats css, floats animations, or floats numbers

quartz kindle
#

Lmao

earnest phoenix
#

On top.gg I saw that we could float the pp of the bot and I would like to know how we do this I hope I was pretty clear

crimson vapor
#

I thought we were talking about numbers

quartz kindle
#

Just to be clear abey, you mean a floating animation?

earnest phoenix
#

Yes

cinder patio
#

the pp of the bot hashflushed

earnest phoenix
#

🗿

quartz kindle
#

Google css floating animation

earnest phoenix
#

I'm starting to believe google is tim's teacher

#

🗿 Very interesting

quartz kindle
#

Youre not wrong lol

crimson vapor
#

he is a dev

#

so maybe

earnest phoenix
crimson vapor
#

what the hell is this

earnest phoenix
#

Aoc

crimson vapor
#

aoc

#

please expand the acronym

earnest phoenix
#

Advent of code

#

0, 2, 4, 6 as in 1, 3, 5, 7

#

Just string and array indexing starts from 0

ivory seal
#

i have a embed something like

.setTitle('mytitle')
.setDescription('mydescription')
.setImage('urlofaimage')
message.channel.send(embed)``` tho the image doesn't come
earnest phoenix
#

🗿 I'm pretty sure tim is trying to pass every challenge in advent of code to reach to my question rn

#

🗿 Advent of code is pretty much a certified bruh moment

#

@earnest phoenix I'm pretty sure you're in love with this emoji 🗿

#

🗿 Yes we moyai

quartz kindle
#

I dont even know what aoc is

#

Im not even home atm lmao

earnest phoenix
#

-bots @earnest phoenix

gilded plankBOT
earnest phoenix
#

@earnest phoenix use testing channels for bots

#

Ok

marble juniper
#

is there any npm package that lets me convert other image Formats into jpg

terse berry
#

When I try to run this line this.client.guilds.get(this.guildID), it says this.client.guilds.get is not a function

marble juniper
#

aka
.png .webp .jpeg
into .jpg

sweet ravine
#

How can I change the colour of the text with css (next to the stars)

quartz kindle
marble juniper
#

hmm ok

earnest phoenix
#

I can't get the CSS. 😅

quartz kindle
#

Show store.js line 30

#

require(filepath) should return a class

#

Console.log it to see what it returns

#

Console.log it to see

#

Literally

earnest phoenix
quartz kindle
#

console.log(require(filepath))

#

Before that line

#

One of your commands returns an empty object

#

{}

terse berry
#

guild.channel.create is not a function, why am I getting this error?

quartz kindle
#

guild.channel doesnt exist

misty sigil
#

guild.channels.create

#

isn’t it?

prisma oriole
#

yeah^

midnight blaze
#

is there someone who used mysql on vps? I am not able to connect and stackflow aint helping, maybe someone here managed to use mysql vps and connect it to their bot

hard anchor
#

hi, I have had a lot of problems creating an embed, can someone pass me their embed code? discord.py

lusty quest
brazen epoch
#

anyone knows any good sites that can help with the webhooks for notifications when a server gets a vote?

lusty quest
brazen epoch
#

oh okay my bad

lyric mountain
#

what's the issue?

lyric mountain
#

then save the placeholder as the desired format

marble juniper
#

*something thats easy to do

lyric mountain
#

that is easy to do

marble juniper
#

no

#

isn't there just some universal package

#

to convert images

pale vessel
#

not sure if canvas supports webp or not

marble juniper
#

I mean I use jimp

pale vessel
#

Jimp works too

marble juniper
#

and it supports most of the image formats

#

but not webp

pale vessel
marble juniper
#

lool

#

I don't really care about the package size

#

its not gonna be used for a browser

lyric mountain
#

"small" -> 34 MB

marble juniper
#

its small if its > 20 kb

#

lol

#

I meant

#

< 20kb

green kestrel
#

I use mysql heavily for everything

lusty quest
#

if you try to connect from remote allow remote connections.

#

(but its not recomended for Production systems)

#

(there are cases where its fine)

green kestrel
#

Is safe enough if you have it set to SSL only plus cert Auth, but still not the best idea

#

And that's not a subject for beginners

lusty quest
#

i have my Databases closed for remote connections. if i need to login i use a VPN

green kestrel
#

I don't have my databases open for remote use at all, if I want to connect remotely I use phpmyadmin, or I tunnel SSH

lusty quest
#

i dont like phpmyadmin had some security issues

#

back when i used mysql ive used mysql workbench running on my pc with a encrypted VPN connection to the database server

buoyant aspen
#

How can I get a user's username and avatar without going through the oauth flow? (Like what KSoft does, it can get a user's info even if the user has never signed in)

pale vessel
#

Fetch the user using a bot token

buoyant aspen
#

Can you fetch a user that you don't share a guild with?

pale vessel
#

Yes

buoyant aspen
#

Ah okay

#

I figured there'd be an API endpoint, but that's easier.

pale vessel
#

It is an API endpoint though

#

With "Bot <token>" as the Authorization header

#

That's all

buoyant aspen
#

Huh. That didn't occur to me.

#

Thanks

pale vessel
#

All good

earnest phoenix
#

ok im back

#

after not learning js cus i don't feel like it

#

is there a way i don't have to learn js and i can still learn how to code?

lusty quest
#

well coding implies that you learn a programing language

restive furnace
#

by reading code

#

not copy pasting it though

hollow sedge
#

You could learn a different language

crimson vapor
#

ok im back

#

hello

pale vessel
#

hi

#

wrong channel or what

crimson vapor
#

tbh I tabbed into the wrong channel

pale vessel
crimson vapor
#

back to testing-1 time

earnest phoenix
#

hi

earnest phoenix
#

Can someone help me

#

pleasee

#

Anyone here?

south sinew
#

Whats the issue

earnest phoenix
#

ok

#

look

#

So the listening for messages

#

do we keep that in index.js?

#

wait nvm i got it

#

someone help pleas

#

please*

#

@quartz kindle

quartz kindle
#

Build an object like this ```js
let obj = {
guildcreate: "guildCreate"
}

quaint peak
#

i have a command that deletes invite links, how do i make it pass for users with admin perms?

@commands.Cog.listener()
    async def on_message(self, message):
        if "discord.gg" in message.content:
            await message.delete()
            await message.channel.send("{} Do Not Send Invite Links Here!".format(message.author.mention), delete_after=5)```
quartz kindle
earnest phoenix
#

when i turn the bot online

quartz kindle
#

Well you didnt explain the problem

earnest phoenix
#

Ok

#

Well here is my coding

#

when i turn the bot online it says that

quartz kindle
#

you put your code outside the message event

#

It has to be inside

earnest phoenix
#

where at?

quartz kindle
#
client.on("message", message => {
    // message exists here
})
// message does not exist here
earnest phoenix
#

don't a ; need to be next to })?

pale vessel
quartz kindle
#

Not required

earnest phoenix
#

is that my problem?

quartz kindle
#

I told you what the problem is

#

Youre trying to use message where it doesnt exist

earnest phoenix
#

im confused its my first time lol sorry for the hard time and im following a site not sure what to do at all i tried. I tried learning js it just wasn't for me i was confused and getting a lot of answer wrong.

quartz kindle
#

Look at my answer

#

Do you see the brackets

#

{}

#

inside those, message exists, outside it doesnt

#

You cannot use message outside those brackets

#

Like i showed

earnest phoenix
#

hmm, ok

#

ohhh so

#

put console.log inside of the brackets?

quartz kindle
#

Everything that uses message needs to be inside there

lusty quest
#

learn js before you jump into it it will save you from some frustration

quartz kindle
#

Your console.log already is there

#

Your if is not

earnest phoenix
#

hi

#

so infront of is

#

so basically put if inside the brackets?

#

what exactly does bitrate mean in video and audio

#

Like that?

lusty quest
#

In telecommunications and computing, bit rate (bitrate or as a variable R) is the number of bits that are conveyed or processed per unit of time.The bit rate is quantified using the bits per second unit (symbol: "bit/s"), often in conjunction with an SI prefix such as "kilo" (1 kbit/s = 1,000 bit/s), "mega" (1 Mbit/s = 1,000 kbit/s), "giga" (1 G...

earnest phoenix
#

Omg

#

if (message.content === !ping) { message.channel.send(Pong.); }

quartz kindle
#

The amount of data per second used to display the audio/video

earnest phoenix
#

so it basically means the average amount of bytes that are used per a time interval to display the audio/video

quartz kindle
#

Yes

slender thistle
pale vessel
#

I see

astral yoke
#
}``` i got this right, it works perfectly but how would i make it so that if basically anything in the sentence has it, it deletes it including other words? because if i do like testfuck it dosent do anything compared to fuck
pale vessel
#

not is just a shordhand for checking if it's False?

slender thistle
#

Well it simply negates the boolean and iirc more efficient even though the difference isn't that significant

pale vessel
#

if "discord.gg" in message.content and not message.author.guild_permissions.administrator:

#

You use it like this?

quartz kindle
astral yoke
#

.some.includes?

quartz kindle
#

No

#

The includes goes inside the second .some

astral yoke
#

it would?

#

would that fix what im trying todo?

quartz kindle
#

Yes, you need a double loop

#

One to loop over words, another to loop over the forbidden words and see if a word contains a part of the forbidden word

astral yoke
#

that would just clarify its not a function

#

if(message.content.split(" ").some.includes(e => data.words(e))){?

manic badger
#

GitHub got dark mode

pale vessel
#

Officially?

manic badger
#

yeah

quartz kindle
pale vessel
#

Pog

quartz kindle
#

.some is a function

manic badger
#

this is a great day for humanity

tired panther
#

How can I create a extra shard?

quartz kindle
#

You already had the first one right

proven nymph
#

hey what can i do with the money i got from Top.gg because it said redeem

pale vessel
#

About time

manic badger
#

ikr

lusty quest
#

no AMOLED darkmode? i like the one discord offers

tired panther
#

Did not tried discord.js light @Tim#2373 pls apoligize me busy with school

lusty quest
#

d.js-light is nice, but you have to work around some stuff. bcs of less cached stuff

astral yoke
#

@quartz kindle then?

tired panther
lusty quest
#

well stuff like permission checks need some stuff cached.

quartz kindle
astral yoke
#

oh

tired panther
#

So how to create a extra shard?

lusty quest
#

yea, i have one command. but you need to cache some stuff for it

#

use internal sharding or sharding manager

twilit geode
tired panther
tired panther
lusty quest
#

you can use pretty much the same method as the normal d.js sharding

#

but d.js-light adds forging with is really nice to have

tired panther
quartz kindle
#

Originally they were named .fake()

lusty quest
#

i havent used it bcs i have no need for it.

quartz kindle
#

xD

lusty quest
#

atleast for now. but idk if i will reach the point anyways with js

tired panther
#

why .fake()?

quartz kindle
#

Because its creating a "fake" instance

tired panther
#

oh

#

whats internal sharding?

lusty quest
#

discord.js handles the sharding on the same process.

tired panther
#

ah okay

#

good to here

lusty quest
#

its also easy to implement

#

you just add a Client Option

#

(also all the broadcasting stuff you maybe need to implement)

tired panther
#

already have them

quartz kindle
#

You dont need them for internal sharding

stable nimbus
#

Is there a way to create a full on module reloader? Like a folder with commands in it?

earnest phoenix
twilit geode
arctic widget
#

hello i need some help, i would like to know when user join & leave voice channel, here is my code :

client.on('voiceStateUpdate', (oldState, newState) => {
  if(oldState.channelID === undefined && newState.channelID !== undefined) {
    console.log('join')
  }
  if(newState.channelID=== undefined){
    console.log('leave')
  }
}``` the console doesn't return join or leave could you help me ?
pale vessel
#

It's probably null instead of undefined

stable nimbus
#

Null is a better definer than undefined.

pale vessel
#

You can just use !oldState.channelID

#

You don't need to check for undefined explicitly

earnest phoenix
pale vessel
#

They meant GitHub and Discord mobile

arctic widget
#

ok flazepe & fuzzy i test it

stable nimbus
#

Okay.

arctic widget
#

Tanks it works 👌

stable nimbus
#

Nice.

#

Happy coding.

pale vessel
#

(or not)

twilit geode
stable nimbus
copper cradle
#

lmao

stable nimbus
#

See if the userid is the author ID and if its true return.

#

Thats what I think.

twilit geode
stable nimbus
#

How do you define user?

#

message.mentions.users.first?

twilit geode
#
if (message.mentions.users.first().id != message.author.id) {
               message.channel.send(`<@${message.mentions.users.first().id}>`)
        }
        else {
            message.channel.send("You can't give yourself a cookie silly!")
        }
stable nimbus
#

Okay I recommend defining user elsewhere and calling for it.

twilit geode
#

yea, but thats not the issue

stable nimbus
#

Makes life easier.

twilit geode
#

but yes

#

i will

#

just testing rn

stable nimbus
twilit geode
#

wait that code was in my command

#
if (timestamps.has(message.author.id)) {
    const expirationTime = timestamps.get(message.author.id) + cooldownAmount;

    if (now < expirationTime) {
        const timeLeft = (expirationTime - now) / 1000;
        return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`)
        
    }
}

here is my cooldown

#

in index

stable nimbus
#

Add a field in there that checks the user id against the author id.

twilit geode
#

hld on

stable nimbus
#

What my thought process says:

twilit geode
#

thats not gonna work

#

because the cooldown acivates when a command gets used, but i want it to cooldown if they send the command correctly, just not when they mention themself

stable nimbus
#
if(timestams.has(message.author.id)) {
if(user.id === message.author.id) return;
if(now < expirationTime) {
  const timeLeft = (expiration - now) / 1000;
  return await message.channel.send(`Please wait  ${timeLeft.toFixed(1)} more second(s) before reusing the \`${cmd.name}\` command again.`);
  };
};
#

There are probably errors in there but yeh.

twilit geode
#

hold on

stable nimbus
#

Thats what I think.

twilit geode
#

i gotta switch classes, ill be back in a few mins

stable nimbus
#

Fair. I don't use switch classes I use a decent command handler from AtlantaBot.

twilit geode
#

nononono i mean switch classes, like irl lol

#

im in school rn

#

lol

stable nimbus
#

Oh lol

#

Honestly thats what I think because to exit early you check if something is true.

twilit geode
#
/home/runner/Aperture-Bot/index.js:69
  return await message.channel.send(`Please wait  ${timeLeft.toFixed(1)} more second(s) before reusing the \`${cmd.name}\` command again.`);
         ^^^^^

SyntaxError: await is only valid in async function
    at wrapSafe (internal/modules/cjs/loader.js:1053:16)
    at Module._compile (internal/modules/cjs/loader.js:1101:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
exit status 1
#

@stable nimbus

stable nimbus
#

Yeah I async everything.

#

ASyncing everything helps a lot, abuse it.

#

You can remove the await keyword however.

#

@twilit geode

copper cradle
#

yeah, why are you awaiting that

hollow sedge
#

Is there a point in "asyncing everything" if you aren't awaiting anything inside?

twilit geode
#

@stable nimbus your code doesnt work

#

it got errors out the wazzoo for every reason immaginable

turbid osprey
#

@leaden cliff

earnest phoenix
#

Hmmm

#

send an screenshot

#

from the json file

#

if there is your token remove it until you got the screenshot

turbid osprey
earnest phoenix
leaden cliff
#

Is the error in main.js?

earnest phoenix
leaden cliff
#

?

earnest phoenix
#

the error ins't at the main.js

#

it's in a json file

sullen talon
#

how do you create a hyperlink in footers of embeds?

leaden cliff
#

So in the package.json file then.

earnest phoenix
sullen talon
#

its like it makes the text blue

#

you can click on it

turbid osprey
sullen talon
#

and sends u to a link

#

but instead of a link

earnest phoenix
sullen talon
#

its a word

#

anyone?

leaden cliff
earnest phoenix
#

`embed: {
color: "PURPLE",
author: {
name: client.user.username,
icon_url: client.user.avatarURL()
},
title: "Click aquí para unirte a mi servidor oficial 🤖",
url: "link",
description: "",

  }`
#

something like that?

sullen talon
#

yee

#

i hope atleast

turbid osprey
#

The screenshot does not fit, I will send it directly as a file

earnest phoenix
#

uh

leaden cliff
#

Ok....

#

Where do you put the Token?

#

I can't see anywhere for the Token.

#

Unless you have it in a different file.

#

Is it an index.js file or main.js file?

turbid osprey
#

In the error, the main.js file of the module seemed to be faulty, so I send it.

leaden cliff
#

Do you have a place for the Token?

turbid osprey
#

token in the settings.json

sullen talon
#

ok so the embed thing that you sent me make my title into a link

#

But im tryna make a word in my footer into my link

#

so i need help wit that

turbid osprey
leaden cliff
#

@turbid osprey Did you create the code or get it from online?

turbid osprey
#

I also bought a bot developer that I watched on youtube

turbid osprey
opal plank
pale vessel
#

Latter

#

It looks really nice

#

also, split your artists 😩

ancient nova
#

@river thistle 2nd

turbid osprey
opal plank
#

the way you spoke seemed like a straight up translation(like, without google translate)

crimson vapor
#

should have known Erwin

#

anyway

#

just making sure, on try catch blocks, err will never be undefined right

try {

} catch (err) {
  if(err) {
  // Code here
  }
}```
quartz kindle
#

it can

#

if you do throw undefined err will be undefined

#

or if you do throw null

crimson vapor
#

but realistically it shouldn't unless a package or my code has some fucked up error handling right?

quartz kindle
#

ye

crimson vapor
#

alright

#

time to fix the like 4 times I used that

#
try {
  if (Math.random > 0.5) throw "some error"
  console.log("Threw some error!");
} catch (err) {
  console.error(err);
}``` would the console.log only run if it does not throw?
pale vessel
#

Yes

crimson vapor
#

ok

pale vessel
crimson vapor
#

I was typing in discord

#

that would always error tho

pale vessel
#

Wdym

crimson vapor
#

wait

#

hmm

#

it would be undefined not "Cannot read property random of"

#

but is undefined > 0.5?

#

no its not

#

huh

pale vessel
#

Math.random()

#

It's a method

crimson vapor
#

yes but I did property not method

pale vessel
#

That would be a function

crimson vapor
#

would Math.random not be undefined

pale vessel
#

No

#

It's a method so that exists

crimson vapor
#

oh wait you're right

quartz kindle
#

it would return a function

crimson vapor
#

why am I so dumb rn

quartz kindle
#

and it would try to compare if function > 5

crimson vapor
#

alright is a function > .5

quartz kindle
#

would return false, but not error

crimson vapor
#

oof

grizzled raven
#

yes

#

very cool

quartz kindle
#

js is very cool indeed

midnight blaze
#

@green kestrel I fix it, but thank you!

earnest phoenix
#

can someone help me?

#

@quartz kindle

crimson vapor
#

what language, library, and issue

#

instead of asking if someone can help, just ask

#

@earnest phoenix ^

slender wagon
#

is there a way i can check someones role and in the base of that a Admin can ban a Mod

gilded olive
#

language and library

#

ah i see js

#

nvm idk kek

slender wagon
#

i mean ik how to do the first one i just need to jump at the action

gilded olive
#

it would be checking if the authors top role is below the targets top role @slender wagon

#

that's the logic but I do not know discord.js

crimson vapor
#

since when does gh have dark mode?

earnest phoenix
#

since today

#

it's apparently been in works for a few months

hollow sedge
#

it looks a little off

crimson vapor
#

its like how it is on phone

#

I do think it is a bit blue

hollow sedge
#

yeah

#

i think there's too much contrast

lyric mountain
hollow sedge
#

yeah that looks better

earnest phoenix
#

hello, I'm mention the bot, making them use commands. but I don't know how to do the message.mentions.members part.

let user = message.mentions.members.array()[1];

it works if I do. - @mention avatar @earnest phoenix
if I do it doesn't work. - /avatar @earnest phoenix

hollow sedge
lyric mountain
#

unnecessary blue

hollow sedge
#

lol

#

the darkmode is definitely way harder to read with

crimson vapor
#

I don't think the dark mode looks bad but its strange

hollow sedge
#

it's a good starting point, but generally they should tone down the colors because ultimately, the point of dark mode is to make it easier on the eyes

earnest phoenix
#

what is the problem ?

#

you must define event(?

hollow sedge
#

the real question is why are you awake at 2 AM

earnest phoenix
earnest phoenix
earnest phoenix
#

wait

hollow sedge
#

OH lol

earnest phoenix
earnest phoenix
quick thistle
#

Hey I have 1 doubt

#

How does vote webhook work ?

jade stirrup
#

does anyone here know how to make websites???

solemn latch
#

I would think a fair few people here do.

jade stirrup
#

well i'm looking for one

earnest phoenix
quick thistle
#

I didnt get it.

earnest phoenix
#

what do you not get about it

quick thistle
#

Like if it makes request to our website

#

then how do we log it in discord ?

earnest phoenix
#

uh

#

what

crimson vapor
#

I agree with cry

#

what

#

I thought you were talking about webhooks

#

authentication would be using oauth iirc

quick thistle
#

Yea I am tlking abt webhooks

crimson vapor
#

not sure

earnest phoenix
#

it's up to you how you interact with discord, that's irrelevant here

top.gg just sends JSON data about the voter to your webhook

quick thistle
#

Hmmm

earnest phoenix
#

a common way to build this is to use a webserver package for your language and alongside that also log in to discord in the app

#

that way you'll have an open webserver and a discord bot in one app

#

for example, node has express, .net has asp.net core etc etc

crimson vapor
#

yea thats how most people do it

quick thistle
#
dbl.webhook.on('vote', (vote) => {
  console.log(`User with ID ${vote.user} just voted!`)
})
#

Im alking abt this

earnest phoenix
#

...okay?

quick thistle
#

yEah so how does this function work ?

crimson vapor
#

so in dbl you put the address of the open webhook and they post to your webhook when someone votes

earnest phoenix
#

which function

quick thistle
#

dbl.webhook.on()

earnest phoenix
#

that's just an EventEmitter method

quick thistle
#

Bruh.

#

Something

main elk
quick thistle
#

Just tell dude

earnest phoenix
#

what do i tell you

#

my social security number?

crimson vapor
#

cry answered you correctly

earnest phoenix
#

my address?

quick thistle
#

no

crimson vapor
#

basically it calls every time the webhook recieves a vote

#

anyone know how I can get that green verified tag on all of my git commits

#

I setup the keys as it says but it didn't work correctly I think

quick thistle
#

@main elk client.GiveawaysManager is undefined

#

make sure u defined at index.js or bot.js

hollow sedge
#

GitHub already has documentation on verifying commits

quick thistle
#

whatever file u have

crimson vapor
#

I mean yes they have docs but there are also docs on literally every js function but people still ask for help here

#

so I guess im more asking for help setting it up

pale vessel
#

I wonder why

crimson vapor
#

lol

hollow sedge
#

Yeah but it's kinda hard to explain how to set up gpg keys

crimson vapor
#

good point

quick thistle
#

Can anone send me the wrapper of top.gg api

#

or npm module link

quartz kindle
#

dblapi.js

quick thistle
#

??

quartz kindle
#

yes

quick thistle
#

Srsly?

#

why ?

quartz kindle
#

because the guy who made it left top.gg

quick thistle
#

Wy?

quartz kindle
#

but thats still the official module

quick thistle
#

Wait so where are the source code of it ?

lyric mountain
#
quartz kindle
#

on github

pale vessel
#

GitHub

quick thistle
lyric mountain
#

well, let's see if this suggestion goes anywhere

pale vessel
#

That is the new one

#

Well, renamed

quick thistle
#

Ye

pale vessel
#

Berry manages that one

quick thistle
#

The new one doesn't work ?

pale vessel
#

It should, but I don't think it's on npm yet

quartz kindle
#

they renamed it? lmao

pale vessel
#

It is

quick thistle
#

Looks like it is

quartz kindle
#

but its still like the exact same thing?

pale vessel
#

It is

sudden geyser
#

Is clang (the compiler) pronounced like if you were to hit a pan with another pan, or just C-lang

quartz kindle
#

lmao

pale vessel
quartz kindle
#

pretty sure its C lang

crimson vapor
#

depends on how you are feeling imo

sudden geyser
#

maybe

pale vessel
quartz kindle
#

Lol

quick thistle
#

Lmao lol

quartz kindle
#

INTeresting

sudden geyser
#

having a bad day? 🍳🍳

crimson vapor
#

maybe you want to say engine-x but simetimes just "en jinks"

quartz kindle
#

true, i do say n-ginx

crimson vapor
#

do you guys know what I mean

#

yeah

quartz kindle
#

i dont say jinx tho

#

i say ginx

crimson vapor
#

I mean

quick thistle
#

lol

crimson vapor
#

idk how to spell

#

does anyone actually say engine-x?

pale vessel
#

I do

crimson vapor
#

o

quartz kindle
#

lmao

pale vessel
#

I used to pronounce it as n jinx

#

Until I read online that you were supposed to pronounce it as engine x

quartz kindle
#

i say neither lmao

crimson vapor
#

is the word spelled ginx or jinx

#

or do you say it a completely different way

quartz kindle
#

if you go for the same sound as "engine", then jinx makes more sense

#

but i say ginx because i never refered to it as engine

#

also because i like the sound of the hard G

#

same with gif

crimson vapor
#

well it is gif

#

with the g

#

ok now I see what you mean

lucid prawn
#
   if(message.content.startsWith(prefix + "mute" )){
        if (message.member.permissions.has("ADMINISTRATOR")) {
            const target = message.mentions.users.first();
            if (target) {

                let mainRole = message.guild.roles.cache.find(role => role.name === '👤| Members');
                let muteRole = message.guild.roles.cache.find(role => role.name === 'muted');

                let memberTarget = message.guild.members.cache.get(target.id);

                if (!args[1]) {
                    memberTarget.roles.remove(mainRole.id);
                    memberTarget.roles.add(muteRole.id);
                    message.channel.send(`<@${memberTarget.user.id}> has been muted`);
                    return
                }
                memberTarget.roles.remove(mainRole.id);
                memberTarget.roles.add(muteRole.id);
                message.channel.send(`<@${memberTarget.user.id}> has been muted for ${message(message(args[1]))}`);

                setTimeout(function () {
                    memberTarget.roles.remove(muteRole.id);
                    memberTarget.roles.add(mainRole.id);
                }, message(args[1]));
            } else {
                message.channel.send('Cant find that member');
            }
        }else {
            message.channel.send('You do not have the permission');
        }
            }

error ms in not denfind

crimson vapor
#

what line?

#

also

#

add the definition for ms at the top of the file

pale vessel
#

Message is a function?

crimson vapor
#

only one way to find out

pale vessel
#

What are you trying to do?

#

Why are you removing and adding the role to the member every time?

#

There are a lot of problems

void skiff
#

any api for fake tweets?

pale vessel
#

Nekobot

void skiff
#

ty ❤️

lucid prawn
#

i change ms to message

#

:/

gilded olive
earnest phoenix
#

does anyone know how to set a bot on phone?

strange viper
crimson vapor
#

Supposedly people who do know won’t tell

earnest phoenix
crimson vapor
#

also supposedly it requires editing d.js code

cerulean ingot
#

i was wondering, could someone help me setup my domain?

#

would this be right

earnest phoenix
#

How to add sort cmd like disconnected 👉 dc

stark abyss
#

elaborate

earnest phoenix
#

What

stark abyss
#

explain

earnest phoenix
#

Huh?

stark abyss
#

what do you mean by that

earnest phoenix
#

Alias

#

Cmd *

stark abyss
#

do you have a command handler 🤔

earnest phoenix
#

Yah

carmine summit
#

how do I replace an item in an array?
[10, 20, 300, 40] to [10, 20, 30, 40]

#

also.. assume that I don't know the key

topaz fjord
#

wdym "key"

#

like the location of the value?

summer torrent
#

hm?

cerulean ingot
#

any ideas?

earnest phoenix
#

name = *

cerulean ingot
#

for a or cname? @earnest phoenix

earnest phoenix
#

a name

cerulean ingot
#

still nothing

earnest phoenix
#

Wait for it to uodate

#

Oh wait

#

@cerulean ingot its @

#

Sorry

cerulean ingot
#

@earnest phoenix thats what i have

earnest phoenix
#

Name on a record should be @

cerulean ingot
#

it is

#

in cloudflair it just replaces it with its root

#

if you do @

uneven monolith
#
        let filter = m => m.author.id === message.author.id
        const loc = message.author.send('Test')
        message.channel.send('LCSN Staff Application has been started, Please confirm in DMs and answer the questons.')
        message.author.send('Are you sure you want to start your application?').then(() => {
          loc.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ['time'] })
          .then(message => {
            message = message.first()
            if(message.content.toLowerCase() == 'yes' || message.content.toLowerCase() == 'y'){
              message.author.send('Yes')
            } else if(message.content.toLowerCase() == 'no' || message.content.toLowerCase() == 'n'){
              message.author.send('No')
            } else {
              message.author.send('Invalid Response')
            }
          })
        })

Im having issues with awaitmessages, error in console says

TypeError: Cannot read property 'awaitMessages' of undefined
#

any ideas?

earnest phoenix
#

Ah

#

@cerulean ingot wait for it to update

summer torrent
#

@uneven monolith loc.dmChannel.awaitMessages

cerulean ingot
earnest phoenix
#

1-10 min

uneven monolith
summer torrent
#

wait it returns as Message

#

loc.channel

uneven monolith
#

With the DMChannel, it still says it is undefined

cerulean ingot
sharp rock
#

@earnest phoenix ey

earnest phoenix
plucky hollow
#

#c

#

! Play

drifting wedge
#

if i have a str

#

how can i get the position of the str in a list?

#

py and js

summer torrent
#

in a list?

#

array?

drifting wedge
#

yes

#

i got the awnser for js already

#

now only py

#

its indexOf() btw

summer torrent
#

i don't know py

drifting wedge
#

LR

summer torrent
#

yes indexOf()

drifting wedge
#

alr

#

ye

#

str.indexOf()

#

why do u need ; for js?

#

like after each line?

summer torrent
#

you don't need

#

it is optional

drifting wedge
#

o ok

cerulean ingot
#

like make it non-www

cerulean ingot
#

i got it thank you though

#

im using cloudfairs page rules

fringe pendant
#

my bots suddenly stopped working today, they're coming online but not sending or apparently reading messages anymore

#

last log message in is the JDA connecting to websocket

#

then nothing

#

they were running until I restarted them , now not working. Anyone have any suggestions?

earnest phoenix
#

Check out the token

#

If it's not the problem re-generate the token and try again

fringe pendant
#

I refreshed it

earnest phoenix
#

Oh

fringe pendant
#

It logs in no problem, just doesn't seem to be seeing messages, or posting

#

no errors thrown

earnest phoenix
#

Wait what library are you using?

fringe pendant
#

JDA

#

they were running all day, and now that i've restarted not working. so weird

earnest phoenix
#

Oh i only know about discord.js

fringe pendant
#

rip

unborn crow
#

Are you still using the deprecated JDABuilder?

fringe pendant
#

I'm not sure, when was that deprecated?

unborn crow
#

so, are you using new JDABuilder() instead of JDABuilder.##?

fringe pendant
#

jda = new JDABuilder(AccountType.BOT).setToken(token).addEventListeners(commandClient).build().awaitReady();

#

looks like it

unborn crow
#

Yeah, you're using the deprecated one.

fringe pendant
#

how recently was that deprecated?

stark abyss
#

I am tryna make an remind command ok so I thought I would take user input turn that into milliseconds and then when Date.now() === Date.now()+userInput time dm them thier msg. Is this a good idea?

unborn crow
#

It has been deprecated for months.

fringe pendant
#

ah, must have broken recently then

#

alright I'll fix that and try again, thanks

unborn crow
#

No problem. pepeMLADY

stark abyss
#

Ink ya got comment on my idea?

#

Don't think it's anything new

fringe pendant
#

@unborn crow it worked, thanks a bunch chief

#

woulda been stuck for hours

#

seems like I'm not getting player lists though from the servers I'm in, did that change as well?

fringe shale
twilit geode
#

so would a cookie command that sends DM's to the recipient be under rule 14 (bot list rules) in #rules-and-info ?

sudden geyser
#

If the user invokes the command and it sends the DM then it's fine.

earnest phoenix
#
@client.command(aliases=['b'])
@commands.has_permissions(kick_members=True)
async def ban(ctx,member: discord.Member,*, reason="No reason provided"):
    if ctx.author.top_role < member.top_role:
        await ctx.send(f"{ctx.author.mention}, you are not high enough in the role hierarchy to do that")
    if member is ctx.author:
        await ctx.send('you can not ban yourself')
        return
    else :
        await ctx.send(f" {member.name} has been ban from the server! Reason: {reason}   https://media.giphy.com/media/fe4dDMD2cAU5RfEaCU/source.mp4")
        await member.ban(reason=reason)```
#

This is my ban command

#

but my admins can kick each other idk why

sudden geyser
#

You probably want to check with <= instead of <.

#

So you can check if the role is the same or higher in role hierarchy.

#

Though you'll probably want to put more checks in place. For example, does the user you want to ban also have permission to ban members? What if the ban fails (try: ... except X as e: ...)?

twilit geode
sudden geyser
#

Eh I don't know about the user mentioned getting a DM since they didn't ask for it. You could ask a mod.

earnest phoenix
#

@sudden geyser

#

NOt working

gilded olive
#

Passing the @commands.guild_only() decorator would solve that dm invoking command issue

#

What's the error

earnest phoenix
#
@client.command(aliases=['b'])
@commands.has_permissions(kick_members=True)
async def ban(ctx,member: discord.Member,*, reason="No reason provided"):
    if ctx.author.top_role <= member.top_role:
        await ctx.send(f"{ctx.author.mention}, you are not high enough in the role hierarchy to do that")
    if member is ctx.author:
        await ctx.send('you can not ban yourself')
        return
    else :
        await ctx.send(f" {member.name} has been ban from the server! Reason: {reason}   https://media.giphy.com/media/fe4dDMD2cAU5RfEaCU/source.mp4")
        await member.ban(reason=reason)```
#

Admins are able to ban each other

gilded olive
#

Dont you have to pass .position as well

earnest phoenix
#

I dont know how to do that

#

it was working fine

gilded olive
earnest phoenix
#

Suddenly it went brr

gilded olive
#

And you get no traceback error?

earnest phoenix
#

nah

#

Lemme remove my error handler

mint charm
#

where does this eror come from
TypeError: Cannot read property 'get' of undefined

gilded olive
#

What

#

Code?

mint charm
#

i didn't encounter this thing since 5d ago

#
TypeError: Cannot read property 'get' of undefined
at Object.module.exports.play (/app/handler/play.js:4:30)
at module.exports.play (/app/handler/play.js:18:22)
    at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:23240) UnhandledPromiseRejectionWarning: Error [VOICE_PLAY_INTERFACE_BAD_TYPE]: Unknown stream type
    at VoiceConnection.play (/rbd/pnpm-volume/71866528-40ae-4780-a1fa-ab254fbee7da/node_modules/.registry.npmjs.org/discord.js/12.5.0/node_modules/discord.js/src/client/voice/util/PlayInterface.js:84:11)```
gilded olive
#

Oh js... 😩

#

Cant help ya there blobpain

sudden geyser
mint charm
#

i mean 5d ago was when i last time updated my code

vague imp
mint charm
#

which

sudden geyser
earnest phoenix
#

Welp

sudden geyser
#

It means you tried to use .get on something that was undefined

mint charm
earnest phoenix
#

It still banned

sudden geyser
#

client.queue is undefined

#

Either you didn't set the property or client is not what you expect it to be.

earnest phoenix
#

It still bans admins

tribal siren
#

how to properly do messageattachment in the bulkdelete like this?

#

i got this code

#
bot.on('messageDeleteBulk', async messages => {
  const attachment = new Discord.MessageAttachment(messages)
  bot.channels.cache.find(ch => ch.id === '779582435364175872').send(`Here:`, attachment)
});```
ivory seal
#

is there any alternative ways to sort arrays appart from thsi?

              return b.data-a.data;
            })```
#

because it returns a innacurate

tranquil drum
#

what is data?

ivory seal
#

its a value in my array

#

so in my array[0] for exampel theres ID and Data

#

@tranquil drum

tranquil drum
#

sort should be accurate

#

unless data is a number that's stored in a string

ivory seal
#

data isn't

#

data is a number

#

not a string

#

and it does sort its just not exactly accurate tho

tranquil drum
#

what do you mean exactly?

ivory seal
#

so like

#

every time a person messages, 1 is added to their key in quick.db

#

then for a leaderboard i get all the data with db.all() then sort it in descending order

#

but a person with 1000 messages doesn't come in the array but a person with 900 messages comes on top.

tranquil drum
#

that sounds like there's some string sorting happening

#

9 > 1

ivory seal
#

tho all my values are numbers?

#

that gets called in client.on(message)

tranquil drum
#

what about when you grab the data back out?

#

your data types are at the whim of whatever function is getting the data from the db

ivory seal
#

ok one sec

#

im gonna console top20\

#

to see the values

tranquil drum
#

just for fun try this

const top20 =a.sort((a,b)=>{
              return parseInt(b.data)-parseInt(a.data);
            })
pale vessel
#

I'd use Number()

ivory seal
#

kk one sec

#

don't both do the same thing

tranquil drum
#

only if your data type is guaranteed to be int

#

Number will parse floats as well

ivory seal
#

ah kk

#

just give me like a min or 2 rq

#

so i can update the code

#

nope @tranquil drum some still don't come

tranquil drum
#

unlucky

ivory seal
#

what else should i do?

tranquil drum
#

log the array before you're sorting just to make sure all the data that you expect to be there is there

ivory seal
#

ye i did

tranquil drum
#

is it in there before and not after?

carmine summit
#

how do I replace an item in an array?
[10, 20, 300, 40] to [10, 20, 30, 40]

tranquil drum
#

array.splice

carmine summit
#

assuming that I don't know the key

tranquil drum
#

use indexOf to find the key

carmine summit
#

but that only replaces the first instance

#

assuming i have multiple instances of it

ivory seal
#

i limit the length of my array to 20

#

maybe i shoudn't?

tranquil drum
tranquil drum
ivory seal
#

wdym teemaw?

carmine summit
#

what if its too big

ivory seal
#

like sort it while im getting it?

tranquil drum
#

sql and mongo support sorting in the query

tranquil drum
ivory seal
#

im using quick.db

tranquil drum
#

what does quick.db connect to?

ivory seal
#

sec

tranquil drum
#

ahh sqlite

summer torrent
#

bettersqlite iirc

tranquil drum
#

you should look in their docs to see if they have a method for sorting

ivory seal
#

ye

#

sqlite

#

they don't

tranquil drum
#

these docs are kinda bad

#

I suspect there's one that you can give in the options object but there's no way to be sure

#

damn it actually doesn't

#

their lib doesn't use SORT BY

#

it'll let you do SORT BY

ivory seal
#

the thing is

#

it worked last month

#

now its not

tranquil drum
#

did you have less than 20 rows last month?

ivory seal
#

i had 17k

tranquil drum
#

weird

#

you're limiting your db get to only 20 rows?

ivory seal
#

yes

tranquil drum
#

maybe the db lib just happened to return the top 20 ones

ivory seal
#

nah actually i get all 17k rows

tranquil drum
#

cause it's not guaranteed

ivory seal
#

thenn i do top20.length =20;

tranquil drum
#

oh

#

idk why it's not working then

ivory seal
#

ye

tranquil drum
#

you could implement your own sort algo

#

but the built in one should always work

ivory seal
tranquil drum
#

v8 devs write tests for that kind of stuff

pale vessel
ivory seal
#

they are

pale vessel
#

Have you tried sorting them before changing the length?

ivory seal
#
              return parseInt(b.data)-parseInt(a.data);
            })```
tranquil drum
#

top20 is the result of the sort

ivory seal
#

i do do that

#

i sort them

#

then change the length

#
            let a =all.filter(e => e.ID.startsWith('messages-')); 
            const top20 =a.sort((a,b)=>{
              return parseInt(b.data)-parseInt(a.data);
            })
            top20.length =20;```
pale vessel
#

Try logging your variables

#

Hm, that's too much

ivory seal
#

like log all,top20 and then top20 after length?

tranquil drum
#

yeah

#

log a as well

pale vessel
#

17k rows, you said?

tranquil drum
ivory seal
#

s

#

last month

#

but that was 30 days

#

should be lesser now

#

i logged all vars give me a sec

#

should i log like .data?

pale vessel
#

map them by data, yes

#

That's what you'll be sorting

ivory seal
#

yep

#

i got undefined

#

wait

#

top20 is a array containign many objects

#

all is too

#

so i can';t join console top20

#

right?

carmine summit
#

how does .indexOf() work?

summer torrent
#

takes string

carmine summit
pale vessel
#

You need to use findIndex for complex things like that

summer torrent
ivory seal
#

@pale vessel ut dies return values top20

#

tho still misses out values

carmine summit
#

I just wanted to replace an array inside an array with an array

terse berry
carmine summit
#

someone help me?

#

also how do I check is an array is inside an array

#

assuming that I have no idea what the index is

#

btw im making "Snake" game using a discord bot

#

you know that game when you hit your body you die

pale vessel
carmine summit
#

How do I?

pale vessel
#

You can use array.some()

#

If one of the elements inside the array is an array, it will return true

carmine summit
#

How do I replace an array inside an array with an array?

pale vessel
#

Find the index of the array by using array.findIndex() and use that index to replace it by using array[index] = newArray;

#

For example:```js
const array = [[1, 2], [3, 4], [5, 6]];
const toReplace = [3, 4];
const index = array.findIndex(x => x.toString() === toReplace.toString()); // 1

array[index] = [99, 99];
array; // [[1, 2], [99, 99], [5, 6]];```

carmine summit
#

that is more complicated than I thought but its that not that complicated

#

Why am I not able to use indexOf

night widget
#

hello

carmine summit
#

.unshift() kinda modifies the existing array and doesn't produce a new array...

#

How can I add items infront of the array without it modifing the existing array and creates a new array

#

@quartz kindle

pale vessel
#

Create an array clone and unshift that clone instead

spare urchin
#

someone

#

got

#

music bot code on lua

#

?

summer torrent
#

We won't spoonfeed you

spare urchin
#

or help me with

#

bans for permissions

#

bcauz

#

its like that

glad moth
#

botunu 7/24 yapmak isteyen dm

merry remnant
#

why isnt it coming can someone help please

earnest phoenix
#

how to add vc empty and bot dis. auto. ?

merry remnant
#

pls tell

spare urchin
#

client:on('messageCreate', function(message)
discordia.extensions()
local client = message.client
local guild = message.guild
local args = message.content:split(" ")
local command = table.remove(args, 1)
local test = "tak"
if command == "?ban" then
local Member = message.member
if Member:hasPermissions("ADMINISTRATOR") == true then
local nick = table.concat(args, " ")
local nicktwo = "test"
if nick and string.match(nick, "<@!%d+>") then
print("Ban ".. string.sub(nick, 4,-2))
nicktwo = string.sub(nick, 4,-2)
elseif nick and string.match(nick, "<@%d+>") then
print("Ban "..string.sub(nick, 3, -2))
nicktwo = string.sub(nick, 3, -2)
elseif nick and string.match(nick, "%d+") then
print("Ban ".. string.match(nick, "%d+"))
nicktwo = string.match(nick, "%d+")
else test = "nie"
end
local User = client:getUser(nicktwo)
local UserTwo = guild:getMember(nicktwo)
User:send('Otrzymujesz bana na serverze nazwa servera')
guild:banUser(nicktwo)
message.channel:send {
content = " " .. nick .. " został zbanowany.",
}
User:send('dostałeś bana!')
end
if test == "nie" then
message.channel:send {
content = "Niepoprawna nazwa użytkownika!",
}
end
else message.channel:send {
content = "Nie posiadasz uprawnień do banów!",
}
end
end
end)

carmine summit
spare urchin
#

its correct?

carmine summit
#

@pale vessel