#development

1 messages · Page 1899 of 1

earnest phoenix
#

Thats my command handler

#

Tell me what should i do

thorny flume
proven lantern
#

can you give me a high level overview of what you are doing?

#

you might need to change some ways you do things

earnest phoenix
#

Its my way to load slash commands

proven lantern
#

what is the high level overview of your bot and the commands?

#

what is the purpose?

earnest phoenix
#

Manage guilds

proven lantern
#

how are you commands currently organized?

#

["1","2","3"].includes("1")
{"1":true,"2":true,"3""true}["1"]

earnest phoenix
#

commands/moderation/ban
commands/fun/lol

#

If you ask it

proven lantern
#

/moderation ban: @user

#

does that work for the ban command?

earnest phoenix
#

No

#

/ban user

#

/kick user

#

/nuke channel

proven lantern
#

why do you need to change those commands dynamically?

earnest phoenix
#

Bc i want it like it

proven lantern
#

i think they are going to force you to make some changes

#

/moderation ban:@user kick:@user nuke:@channel

#

i'd create a moderation command with options

#

ban, kick, and nuke as options

earnest phoenix
#

Ok i do it

#

But will not remove others

proven lantern
#

sounds good

rocky hearth
#

can I have nested sub commands to any level?

proven lantern
#

at least 3 levels

#

idk if more are supported

#

i use 3 levels

lament rock
#

![string1, string2, string3].includes(variable); // boolean indicating if the array does not include the variable

rocky hearth
lyric mountain
earnest phoenix
#

Whats happening here, im confused

#

why does i stop at 11

#

and just loops forever

lyric mountain
#

shouldn't u let i = 0?

proven lantern
#

what does funcs.rand do?

earnest phoenix
proven lantern
#

noice

earnest phoenix
#

x is an array

#

why is 0 always undefined

lyric mountain
#

var

#

never use var

#

var bad, he hates u and u should too

earnest phoenix
#

again

#

This isnt really funny

#

cringe anime scammer strikes again

proven lantern
#

what is nitro?

earnest phoenix
#

Nobody falls on this

earnest phoenix
earnest phoenix
#

the dlscord scam was very well made

#

So flex website

#

looks like the sites i made when i first started

proven lantern
#

@scenic kelp

lyric mountain
#

change ur password, fast

earnest phoenix
#

They cant hack me when i click on it lol

#

does it have capatcha?

#

on submit

#

Idk just got ss and quit

lyric mountain
#

I mean, there could have been a page before that one which logs the token

earnest phoenix
#

doubt

lyric mountain
#

you used discord's browser after all

proven lantern
#

that domain doesn't have an oauth token

earnest phoenix
#

No discord ask me everytime for log again

proven lantern
#

unless you gave it one

earnest phoenix
#

So my discord isnt open in browser np

earnest phoenix
proven lantern
#

x[i] = "something"

earnest phoenix
#

ye ye

#

let

#

fixed it

#

let

proven lantern
#

dont use let

#

use const

earnest phoenix
#

ok ill use const

#

Doesnt make sense

#

i have 20 minutes of javascript tutorials

proven lantern
#

you should be a pro now

earnest phoenix
#

const or let

#

Same thing

lyric mountain
#

cuz i++ will be impossible

earnest phoenix
#

really? const wont work in a for loop

proven lantern
#

forof

lyric mountain
#

for farofa it'll work, just not for normal for

earnest phoenix
#

also

#

its still undefined

proven lantern
#
for (const thing of arrayOfThings) {
  console.log(thing)
}```
lyric mountain
#

farofa != for

#

and he needs the index anyway

proven lantern
#

arrayOfThings.map((thing, index)=>({}))

earnest phoenix
#
for(let i = 0; i < 1: i++) {
console.log(i)
}
lyric mountain
#

ye, normal for

proven lantern
#

that is using let

#

so you should avoid normal for

lyric mountain
#

...he needs the index

proven lantern
#

arrayOfThings.map((thing, index)=>({}))

#

or reduce if you need one to many

lyric mountain
#

arrow func is less optimized than for

earnest phoenix
#

it works

lyric mountain
#

and using let is not that big deal

earnest phoenix
#

x[i] 0 works

proven lantern
#

better for running on more than one processor

earnest phoenix
#

but it returns undefined when added to b

lyric mountain
#

js is monothread

earnest phoenix
proven lantern
#

the problem can be split up

#

and monothreaded in parallel

#

for loop is locked to the processor

lyric mountain
#

if you try to parallel an array op you'll end up with unsorted results

#

and in his case it must be ordered by index

#

so normal for is the best here

earnest phoenix
#

And you cant use const in for

proven lantern
#

so use a reduce function

lyric mountain
#

...arrow func

earnest phoenix
#

async function() => {
}

lyric mountain
#

still arrow, but now the whole result is unordered

proven lantern
#

embrace the arrow

earnest phoenix
#

oh xd

#

code was ok

#

b was the problem

#

it was just var b

lyric mountain
#

never use var

proven lantern
#

i write software for ie5

#

i'll try using const

earnest phoenix
#

can u use explicit types in js

lyric mountain
#

not even microsoft is supporting ie5 anymore

proven lantern
#

wouldn't that be aweful

lyric mountain
#

that's typescript basically

proven lantern
#

but dont use typescript

#

you only get the bad

#

no performance

#

just static type

lyric mountain
#

static typing is way better, no need to figure out what type a var is during debugging

#

and ctrl + space becomes useful

proven lantern
#

when you're debugging the issue caused by using types

lyric mountain
#

the ide will point it first

proven lantern
#

sorry, i can't let you do that...

#

that's what types do

lyric mountain
#

I mean, it's not normal to call .walk() on let plane = new Plane()

proven lantern
#

classes

#

dont use those

lyric mountain
#

with types you know where the issue is beforehand

proven lantern
#

oop causes the issues

#

just write pure functions

#

and an imperative shell

cinder patio
#

God you're obnoxious

proven lantern
lyric mountain
#

oop/state ftw

boreal iron
#

Somebody's blaming Kuhakuwaagabunkuu? I'm in!

lyric mountain
#

only if u hate oop

boreal iron
#

Damn... got so exciting

wheat mesa
#

oop on top

reef stump
#

@earnest phoenix Hi Bro

earnest phoenix
#

@reef stump hi?

wheat mesa
#

I struggle to live without types now, going back to js stuff once you’ve done ts is such a pain

#

(And most other statically typed languages)

reef stump
#

@earnest phoenix The Rolex Bot Is Your Bot

earnest phoenix
reef stump
#

@earnest phoenix Can You Send Me Your Project A Bot

earnest phoenix
reef stump
#

@earnest phoenix Dm

wheat mesa
#

Anyone know how to tell the type of an array in ts? I currently use the typeof operator but it returns object when used on an array. I’d prefer for it to return either Array<T> or T[]

#

I suppose I could look at the first element of the array, and take the type of that

lyric mountain
#

use constructor ig

woeful pike
#

you have to look at the individual element types

#

there's no of "an array of things" in js, it's just an array object or something else

wheat mesa
woeful pike
#

just use typescript DANKIES

wheat mesa
#

I am

lyric mountain
woeful pike
#

ok so you're probably going to just need to check array[0] or array.every(someTypePredicate)

wheat mesa
#

I think the solution is to check if the value is an array, check the first element’s type, then interpolate a string of like Array<${typeof(arr[0])}>

#

Something like that should work just fine

woeful pike
#

what are you trying to do in the first place

wheat mesa
#

For an eval command, just trying to set an embed footer to whatever type the returned value from the eval is

#

Not that I can’t tell by looking at it, just looks better than seeing Type: object when it’s clearly an array

#

Even though it’s not wrong

woeful pike
#

I see

cinder patio
#

@ripe prairie ^^^

stiff lynx
#

TypeError [INVALID_TYPE]: Supplied data.type is not a valid MessageComponentType.

#

what is this

#

type is deprecated

green kestrel
#

yay got it working at last

#

finally got some nice connection pooling going, with background queues too... i threw away one implementation because making the threading safe was doing my head in

#

so i simplified 😄

modest maple
#

Sip Imagine thread safety in C++

green kestrel
#

its not too hard if you dont over engineer

slender wagon
green kestrel
#

no

#

at last

#

at least means "at least it works" and the other is like "at last, it works"

slender wagon
#

Didnt know

green kestrel
#

now you do 😄

slender wagon
#

Yep thx lol

green kestrel
#

yw lol

#

hows you

slender wagon
#

Good 👍

woeful pike
#

or like a version of that in whatever db you're using

green kestrel
#

nope

#

its a reporting system i built around the connection pool i created

woeful pike
#

oh cool

green kestrel
#

theres how it works, i commented it

#

theres a few ways of solving the problem, but the other approach i tried i couldnt keep stable so i didnt want to unleash it on live

#

the other approach was a full async-style system where each query had a feedback lambda attached

woeful pike
#

doesn't the busy flag need to be atomic for something like this?

green kestrel
#

depends

#

if it was accessing it would lock 😄

#

which defeats the point

woeful pike
#

oh I guess the struct is the only one accessing it?

green kestrel
#

its non-atomic so that you can access it without locking

#

yeah

woeful pike
#

ok that makes sense

green kestrel
#

if theres a race, and two try at once, the second to try has to wait for the first

#

so its not the end of the world, just slightly sub optimal

#

the same can happen if all the connections are busy at the same time anyway

woeful pike
#

I haven't done cpp in so long and definitely haven't messed with threads. All of this is pretty wild to a baby rust user like me even though a lot of the concepts are similar

#

cool that you built your own thing on top of that. I'm guessing you're keeping stats of these in prometheus or whatever too?

green kestrel
#

rust babysits you a bit

#

im not storing sql stats anywhere atm, this isnt live yet

woeful pike
#

ah ok

green kestrel
#

i'll probably stash it to redis or something

#

it would make sense to stash mysql stats in mysql, but then if mysql is underperforming, or down...

#

so a case of not stashing all my eggs in one basket lol

woeful pike
#

isn't the idea of analytics that you store data separately from the infrastructure it's coming from?

#

but it's a pain to go make a whole new db for that if you don't already have a system for it

green kestrel
#

i tend to store mine in the same place

#

just because i then dont have to manage another system or a third party service for it

woeful pike
#

fair

green kestrel
#

but i dont think i'll report sql low level info there

woeful pike
#

yeah probably too detailed for a high level overview like that

wheat mesa
#

3.6 GB ram usage for 110000 servers! Impressive how good C++ is at managing memory.

woeful pike
#

na it's impressive how good brain is at managing memory

#

you could easily have a discord.js moment making a bot in C++ if you're not paying attention to memory usage

pale vessel
#

he definitely doesn't use that

summer dune
#

Looks like there are ways to generate static (compile-time) reflection for typescript

#

In the end, I ask myself — should I use decorators and metadata at Typescript? And for now, I answer NO

deep bolt
#

Can someone help me with this command?

    async def meme(self, ctx):
        content = get("https://meme-api.herokuapp.com/gimme").text
        data = json.loads(content,)
        meme = discord.Embed(title=f"{data['title']}", Color = discord.Color.random()).set_image(url=f"{data['url']}")
        await ctx.reply(embed=meme)```


ERROR WHEN COMMAND IS RAN


```Ignoring exception in on_command_error
Traceback (most recent call last):
  File "D:\PYTHON\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)```
lament rock
#

You might want to provide more error info since it seems the stack was excluded

deep bolt
#

thats all it throws at me

lament rock
#

@drowsy crag

deep bolt
#

fixed

slender thistle
#

P.S. it's strongly recommended to use async stuff along with async frameworks

#

Instead of requests, use aiohttp

tired panther
#

Or node-fetch

next crown
#

Gm developers

stiff lynx
#

a good paginator package? that works

#

I'm to lazy to code it by myself

cinder patio
#

@rose warren ^

rose warren
#

Ty

modest maple
#

Takes like 5 minutes

stiff lynx
pale vessel
#

Is it lazy or skill issue

stiff lynx
modest maple
#

Why make a bot then mmLul

errant flax
#

its ez to make page thing

stiff lynx
#

considering that findOneAndUpdate is deprecated, what should I use?

cinder patio
#

updateOne

#

I feel like we've had this convo before

pale vessel
#

it's not deprecated...

slender wagon
#

@rose warren @drowsy crag

slender wagon
#
 bruh = klasa[i].textContent.slice(0, -1);
 console.log(bruh);
#

yes free nitro

#

@small plume @solemn latch

stiff lynx
stuck star
#

How to make bot in vc 24/7 with repl...?

eternal osprey
#
 const collector = channelwise.createMessageCollector(filter, { time: itemms1, max: 2});```is this max : 2 a thing in djs v12?
flat copper
#

hey
how can i convert this time to "mm:ss"

stiff lynx
#

lol

flat copper
#

any example?

earnest phoenix
stiff lynx
#

how can I reset my slash commands?
I see slash commands that I removed

earnest phoenix
#

minutes = seconds / 60

earnest phoenix
flat copper
#
console.log(moment(data.result[0].from).format("mm:ss"))```
i tried this but 
its giving "00:00"
earnest phoenix
#

are you talking about deleted commands still showing in your discord app OR asking how to delete a command

stiff lynx
#

kicked and reinvited, worked

#

I dont see anymore double commands lol

#

kinda school technician

#

to filter a user is interaction.user.id.cache.includes('user id')?

earnest phoenix
earnest phoenix
#

there is no cache property on there

stiff lynx
earnest phoenix
#

what are you filtering for

stiff lynx
#

for my id 🙂

#

!inter.user.id === owner

#

i did this

#

owner is a variable inside my config.json

earnest phoenix
#

! will make it false

#

false === owner will never work

#

you probably meant !==

stiff lynx
#

this should work, right?

earnest phoenix
#

that say they don't have permission if their id is not the owner's and they don't have manage messages permission

#

try it and see

stiff lynx
#

is a purge command

#

I want to use it also where I have no permission 🙂

earnest phoenix
#

wtf

stiff lynx
# earnest phoenix wtf

My bot is in more than one server and I dont have the permission to delete message with /purge everywhere.

So it is correct to check for permissions for normal user or that I am using the command 🙂

boreal iron
#

You’re checking if the member who uses the command has the required permissions not if your bot has them.

stiff lynx
boreal iron
#

Anyone who’s not "owner" - whatever this var is declared as - can’t use the command anyways

#

If that’s the Discord server owner you don’t actually need a permission check as he always has all permissions

stiff lynx
#

but the owner is the bot owner, so me

boreal iron
stiff lynx
boreal iron
#

And why do you need to check your own permissions?
If you’re in the guilds your bot is in anyways you will need to check if the bot has the permission to execute the action in the first place or the API will return an error.

stiff lynx
boreal iron
#

Yeah since you’re the only one who is able to use this command you don’t have to check your own permissions tho.
Return that permission error if the bot is missing them.

#

If you have these permissions in a guild but your bot doesn’t, executing the command will do nothing other than returning an API error

eternal osprey
#
 return reject(new DiscordAPIError(request.path, data, request.method, res.status));
                        ^

DiscordAPIError: Unknown User
    at RequestHandler.execute (c:\Users\Desktop\gauntlet-v2\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  method: 'get',
  path: '/guilds/885526328437276723/members/0',
  code: 10013,
  httpStatus: 404
}
Process exited with code 1
```why is this constantly happening?
#
 if (minigame1.members.size === 5){
     
      const answers1 = JSON.parse(fs.readFileSync("./answers1.json", "utf8"))
      let channelwise = guild.channels.cache.find(r => r.id === "894180338023145474")
     message.channel.send("**The game room is full! Please be patient and wait till the game ends to join again!**").then(m => m.delete({timeout: 600000}));
     channelwise.send("Hello Everyone! Welcome to the *Knowledge* test!\n**First game: write the answer of the upcoming question in this chat! You have 20 sseconds only!**")
 
       let de = result.Sheet1
       var randomItem = de[Math.floor(Math.random()*de.length)];
       let question = randomItem.A
       let answer = randomItem.B
       let realanswer = answer.toLowerCase()
       const embed1421 = new Discord.MessageEmbed()
       .setColor("RANDOM")
       .setFooter("Provided by Gauntlet Bot!")
       .setTimestamp()
       .setDescription(`Question: **${question}**. Please write the answer down in the chat!`)
       let hey = await channelwise.send(embed1421)
       console.log(answer)
           const filter = m => m.author.id != client.user.id;
         const collector = channelwise.createMessageCollector(filter, { time: 20000 });
           collector.on("collect", async m => {
         
            if(m.content.toLowerCase() == realanswer){
             let op;
             answers1.userids.push(m.author.id)
             fs.writeFileSync("./answers1.json", JSON.stringify(answers1))
            m.author.send(":white_check_mark: **You have passed the knowledge test, time for the next challenge...!**")
           
            }else{
             m.author.send(":x: **This answer was wrong!**")
      
            }
            })
}

     ```
eternal osprey
earnest phoenix
#

and PLEASE don't use JSON for a database

eternal osprey
earnest phoenix
#

idk

spark flint
#

@solemn latch

errant flax
pale vessel
#

You mean the timeout property

errant flax
#

ye

#

that

boreal iron
stuck star
#

Can u say about auto connect vc in music bots????

visual bone
spark flint
#

works for me

earnest phoenix
#

iirc A records cannot point to a different domain like repl.co
only CNAME works

#

but most browsers will automatically add www in the url so it probably doesn't matter

cunning pilot
#

What are the best places to host and/or code a bot? I'm just curious what you think as I just started my world of coding :).

earnest phoenix
#

@earnest phoenix yo what

spark flint
boreal iron
spark flint
#

Contabo is only £5.99 a month for 8GB ram but unless you commit to a minimum term, you have to pay upfront a small amount

earnest phoenix
boreal iron
#

He said:

The Alias of my website doesn’t work…? i use replit

earnest phoenix
#

i use replit

boreal iron
#

His CNAME record points to the right target

earnest phoenix
#

apparently their repl is offline on the www one

earnest phoenix
#

the normal one works

boreal iron
#

His DNS cache probably just wasn't up to date

earnest phoenix
spark flint
#

basically a virtual PC

cunning pilot
#

Oh I see

#

What about for coding?

earnest phoenix
#

a virtual computer made to run programs

spark flint
#

you can code on them too if you install an OS with a GUI

#

I have Lubuntu on my VPS

earnest phoenix
#

I write my code in codesandbox then deploy it to vercel's vps

spark flint
earnest phoenix
#

is vercel a vps tho

spark flint
earnest phoenix
#

alr

spark flint
#

I code using Replit then I copy over to my VPS

cunning pilot
#

Interesting

earnest phoenix
#

I code using jetbrains

earnest phoenix
spark flint
#

nope

#

SSH

earnest phoenix
#

🤫 shh

spark flint
#

or just straight up copy and paste

#

code, copy, paste in VPS

#

RDP allows copy paste between PCs

cunning pilot
#

Is there any places you guys learned code stuff or is it made easier? Or tutorials?

lyric mountain
#

imagine transferring thousands of lines through copypaste

cunning pilot
#

I see

spark flint
earnest phoenix
spark flint
#

and w3schools

earnest phoenix
#

those are the things I used

earnest phoenix
#

damn python makes no sense

lyric mountain
#

oh, intellij now has tutorial for ide

spark flint
#

like 25 lines

#

etc

earnest phoenix
earnest phoenix
boreal iron
earnest phoenix
#

I remember a few months ago I installed intellij and it asked if I wanted to do the tutorial

#

compress all files and decompress on vps

#

¯_(ツ)_/¯

lyric mountain
#

which is cool cuz I don't need to teach people how to use it anymore lul

earnest phoenix
#

kek

#

yea I didn't take the tutorial

lyric mountain
#

although my old college will probably stick to eclipse

earnest phoenix
#

eclipse is eh

lyric mountain
#

yuck

earnest phoenix
#

I didn't really like it

lyric mountain
#

idk what people see in eclipse

earnest phoenix
#

I prefer jetbrains over everything

lyric mountain
#

nor netbeans

earnest phoenix
#

simplicity maybe?

#

I tried to make a minecraft java mod in eclipse
didn't go well

spark flint
earnest phoenix
#

I've heard eclipse is supposed to be easier to use

earnest phoenix
cunning pilot
#

I think I had a program on my computer for code

earnest phoenix
lyric mountain
#

I mean, given the obscene amount of tools and integrations intellij has I'd say eclipse is harder to use

earnest phoenix
#

yea

#

intellij is just nice :p

lyric mountain
#

like, imagine not having clear and simple vcs integ

earnest phoenix
#

I use it when im messing with kotlin

lyric mountain
#

I like intellij's textfield language injection

#

helps a lot coding on database

cunning pilot
earnest phoenix
#

noice

#

I noticed a lot of jetbrains ides have built in db support

lyric mountain
#

all of them have iirc

cunning pilot
#

I can confirm, VSC

earnest phoenix
#

so you can simply connect to your database in the ide and look at the tables and its content

#

though I still prefer dbeaver most of the times

cunning pilot
#

What's the most beginner friendly?

earnest phoenix
lyric mountain
#

define "beginner friendly"

earnest phoenix
#

language, editor?

cunning pilot
#

Oh, sorry

#

Program for code

lyric mountain
#

depends on language

earnest phoenix
#

Depends on your language tbh.

cunning pilot
#

Beginner friendly as in its easier to learn, I suppose

#

Java

lyric mountain
#

intellij

cunning pilot
#

I'm most familiar with Java :')

lyric mountain
#

nothing beats intellij when it comes to java

earnest phoenix
#

Vscode is really useful for every language but it has its limitations compared to a dedicated ide

cunning pilot
earnest phoenix
#

ye intellij is amazing

#

Really any jetbrains product is better than vscode or likewise

lyric mountain
#

unless you meant javascript, in which case I say intellij too kekw, but only if u get ultimate version

stiff lynx
#

module.exports.run = async ( inter ) => {
    let aiuto = new discord.MessageEmbed()
    .setTitle('**Ecco i comandi di NOVABOT**')
    .setDescription('tutti i comandi sono slash, quindi il prefisso è **/**')
    .addField('CATEGORIA DIVERTIMENTO', '/divertimento', false)
    .addField('CATEGORIA MUSICA', '/musica', false)
    .addField('CATEGORIA GESTIONE', '/gestione', false)
    .addField('CATEGORIA MONETE', '/monete', false)
    .setFooter('**NOVABOT**')

    await inter.reply({ embeds: aiuto})
}

module.exports.help = {
    name: 'aiuto'
}```
earnest phoenix
#

intellij for javascript eh

#

I prefer webstorm for js stuff

stiff lynx
#

why this doesnt work?

lyric mountain
#

ultimate has webstorm built-in basically

earnest phoenix
#

Yea

#

I don't even touch js anymore

cunning pilot
#

I had no idea java and Javascript were different

earnest phoenix
#

Last time I used js was last week when I had to take the beginner course to programming in my cs class

cunning pilot
#

What's the easier language to learn?

earnest phoenix
lyric mountain
#

javascript was born to be the middleman between user and java for browser

earnest phoenix
earnest phoenix
lyric mountain
#

but now it is its own lang with frameworks and stuff

earnest phoenix
#

java is pain on steroids

#

js is said to be easier to learn than java tho

#

but some people just understand certain things more than others

earnest phoenix
lyric mountain
stiff lynx
#

no reply and no err

earnest phoenix
#

I bet you it doesn't even run the code inside it

lyric mountain
#

add console.log("works!") on the first line inside import

cunning pilot
#

So should I continue js for my next project?

earnest phoenix
#

up to you

#

we can't choose for ya

#

js is definetely easy

#

though if you know the language and don't feel like learning another then stick with what you know

lyric mountain
#

for me it was java, never got used to dynamic stuff

earnest phoenix
#

but java is static typed so less errors

#

tbh you should start with html

cunning pilot
#

Awright, this all definitely really helped me, thanks-

lyric mountain
#

know what, learn both java and javascript

cunning pilot
#

I've heard of html

earnest phoenix
#

mmmm I dislike js now that i've met go

stiff lynx
earnest phoenix
lyric mountain
#

show where u call it

earnest phoenix
#

try pressing Ctrl + Shift + I

#

Well ima cya guys later bye!

cunning pilot
lyric mountain
earnest phoenix
#

do not tell me you code on mobile

cunning pilot
#

What's supposed to happen

stiff lynx
#
        {
            name: 'aiuto',
            description: 'lista dei comandi'
        },```
#

this is in my dataHandler for slash commands

cunning pilot
earnest phoenix
#

breh

cunning pilot
#

Ah I see

cunning pilot
lyric mountain
earnest phoenix
cunning pilot
#

Oh wait

stiff lynx
#

I don't get why it doesn't enter the code 😦

cunning pilot
#

It's the inspect command, isn't it?

#

I used to use it on roblox to make me look rich LOL

earnest phoenix
#

lmfao

#

some people really think inspect tool can actually hack a website

lyric mountain
stiff lynx
#

how?

lyric mountain
#

what ide u use?

cunning pilot
#

Roblox has gotten smarter, it seems

lyric mountain
#

nothing beats discord's console spam

stiff lynx
cunning pilot
lyric mountain
vivid fulcrum
#

queue bUt VSc Is nOt An IDE

lyric mountain
cunning pilot
#

Aaa okay

#

Can't I right click and inspect?

#

Ah, I cant

lyric mountain
#

the "wait a minute" message starts spamming as soon as you click console

cunning pilot
#

"Hold up" lmao

stiff lynx
lyric mountain
#

hmmmm...what is this.options?

stiff lynx
lyric mountain
#

how don't u know?

#

is that from a lib?

stiff lynx
#

no library and no this.options

lyric mountain
#

idk what to say, if it didn't log then the error isn't there

stiff lynx
#

I put it on top of the embed

#

And I got the work in console

lyric mountain
#

then double check whether youre sending the embed correctly

#

check dem docs

earnest phoenix
#

nope

#

it seems to work fine

flat copper
#
async function sendWeb(name, av, message, Channel, msg){
let channel = message.guild.channels.cache.get(Channel)
if(!channel.permissionsFor(message.client.user.id)
					.has('MANAGE_WEBHOOKS')
			)
				return message.channel.send({
					embeds: [{
						title: 'Invalid Permission',
						description: `**I dont have permission to Manage Webhooks**! ${
							channel.name
						}`,
						color: 'RANDOM'
					}]
				});

  
  let webhook = await message.guild.channels.cache.get(Channel).fetchWebhooks();
					
					let webhok = webhook.find(x => x.name === 'DEMON-CHAT-BOT');
					if (!webhok) webhok = await message.guild.channels.cache
							.get(Channel)
							.createWebhook(`DEMON-CHAT-BOT`, {
								avatar: av
							})

  console.log(webhook)
  
					await webhok.edit({
						name: name,
						avatar: av
					});
					await webhok.send(msg).catch(err => {console.log(err)});

					await webhok.edit({
						name: `DEMON-CHAT-BOT`,
						avatar: message.client.user.displayAvatarURL({ dynamic: true })
          })
}```
why its not working
lyric mountain
#

the hell is that formatting

earnest phoenix
#

webhok and webhook and Channel

flat copper
#

lol

#

im not that good at coding so yh

slender thistle
#

Keep your variables clear

#

And follow naming conventions wherever possible

earnest phoenix
#

why do people start bot development before learning programming

slender thistle
#

Because it's exciting

pale vessel
#

Beats me

#

It works though™️

earnest phoenix
cinder patio
lament rock
#

An ambitious first project can teach you a lot of concepts

#

making a discord bot and wanting to support it for the forseeable future is nothing short of ambitious

#

being aggressive in optimization can also lead you down a dark path

earnest phoenix
#

Is there any way to share my codes in vsc

lament rock
#

There is a live share extension

#

but that's for collab

earnest phoenix
#

I wanna share with other friend

#

Like he can see my codes and design

lament rock
#

I'd just put it on a private github

earnest phoenix
#

Like glitch

#

Or replit

lament rock
#

don't use free hosting services

cinder patio
#

use git to collab

earnest phoenix
#

Why

lament rock
#

because it's the best code controller

earnest phoenix
#

What if i dont have money lol

cinder patio
#

it's free

lament rock
#

Well. Git is free. As for hosting… Welp. Sucks

cinder patio
#

private github repositories are free

#

up to three collaborators

earnest phoenix
#

Okay

#

But the question i asked is there a way to share my codes in vsc

#

Live

cinder patio
#

first search result

lament rock
#

that was literally what I said as well

cinder patio
#

@drowsy crag that ad ^

earnest phoenix
#

Ok thanks

#

anyone know how to send a message to a channel when you only have the channel id in d.py?

#
channel = bot.get_channel(id)
await channel.message.send(msg)
spark flint
#

channel = client.get_channel(channelid)
await channel.send("msg")

spark flint
#

^^

#

Or Tyrones response

earnest phoenix
#

thank you

earnest phoenix
olive rune
#

channel.message.send isn't a thing

lyric mountain
olive rune
#

smh

#

@solemn latch nitro scam :p

earnest phoenix
olive rune
earnest phoenix
#

Yes it was mb

earnest phoenix
#

what kind of library has channel.message

vital void
#

error: (node:1573) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined

code: ```module.exports = {
name: 'afk',
description: 'makes u afk',
execute: async(client, message, args) => {
const memberid = message.author.id ;
let reply = args;
if(!reply) {
const reply = 'No reason was provided'
}

    /*const data = await schema.findOne({ USER: message.author.id });
    if(data) return ;*/
    const newData =  new schema({
        USER: memberid,
        REPLY: reply,
    })
    newData.save();

.......```

can anyone help me why is message.author.id arising error

cinder patio
#

You mean message.member.id? If the message was sent in DMs there won't be a member property

#

Also if it was a system message I think

#

Why would you want to do that?

vital void
cinder patio
vital void
cinder patio
#

yup, console log message at the start of the function

vital void
#

ok trying

vital void
cinder patio
#

Well there you go, client is actually your message object

vital void
cinder patio
#

yup, or actually provide the client as the first argument of the function, but that'll probably break the rest of the commands, you don't really need to provide the client to the function, you can access it with message.client

vital void
#

ok lemme test

summer dune
#

Where does everyone host their bots?

earnest phoenix
#

Let's say I have a React functional component:

function Counter() {
  const [count, setCount] = useState(0);

  // ...
}

To increment the count state, is there any difference between:

setCount(count + 1);

And

setCount(c => c + 1);
cinder patio
#

no

vital void
summer dune
#

Oh I know, I'm wondering what everyone here does specifically

#

I use DO Apps a lot

earnest phoenix
earnest phoenix
summer dune
#

My question was where do you DEPLOY the bot

earnest phoenix
#

on a vps

cinder patio
earnest phoenix
lyric mountain
summer dune
#

I dont see how

lyric mountain
#

Q: "Where does everyone host their bots?"
A: "dedicated server, websites like glitch or replit, or github+ heruko or just local host"

summer dune
#

Yes

cinder patio
#

Look what they replied to man

grim aspen
summer dune
#

I replied to "everyone here makes discord bots with code"

#

Which is not the question I had originally asked

grim aspen
#

The answer is the link I sent or what kuu said

summer dune
#

I like DO apps because theyre really simple to deploy straight from github

#

Just plug in your master branch and it deploys on a new PR/Push

#

Can use any framework. There are a few natively supported ones but anything that's not directly supported, you can use a dockerfile

spark flint
#

Agreed

#

Its great

summer dune
#

No Jenkins needed for simple applications

lyric mountain
#

tbh, even for vps deploying from github is ez, just git pull and you're done

summer dune
#

AND you get a free static HTML website

#

If it's just HTML files, you pay nothing

#

I use DO Apps to host generated doxygen files

cinder patio
#

github actions make me wet

summer dune
#

I like to avoid interfacing directly with server infrastructure if I can

#

I want to be able to avoid using bash when deploying

lyric mountain
#

I like bash for how flexible it is when dealing with pre-init scripts and automated tasks

#

that's exactly what windows lacks

summer dune
#

How do you mean?

#

about "thats what windows lacks"

lyric mountain
#

I mean, windows DO have pshell/batch, but they're so half-assed that they take more time figuring out what you're doing than writing scripts

#

pshell takes the mess to a whole new level

summer dune
#

And to clarify, I dont have any issue with bash spceifically, I just dont want to interface with a shell to deploy a server; I want the act of merging to master to trigger the deployment. Infrastructure should be an abstraction to an application developer, IMO

lyric mountain
#

it's not like in linux where u use scripts for trivial stuff just for the sake of lazyness

summer dune
#

I personally prefer powershell to bash

#

But you can run bash on windows too

lyric mountain
#

ik, but it's not as flexible

summer dune
#

How so?

lyric mountain
#

bash on windows runs sandboxed

summer dune
#

Well there's WSL, and there's also cygwin and mingw

#

WSL is the subsystem component but afaik cygwin and mingw run natively

lyric mountain
#

wsl is what I'm talking abt

#

the others aren't exactly official

summer dune
#

Well there's nothing "official" about bash, exactly

#

I like posh better than bash because it deals with everything as an object rather than a stream of data

lyric mountain
summer dune
#

I'm not sure that's true

#

bash was created by gnu

#

UNIX is a brandname by AT&T but it appears to be managed by opengroup now?

#

Though supposedly Linux is certified Unix Compliant according to some rando website

#

I mean if you take a *nix system like MacOS, they shipped an ancient version of BASH without GNU extensions until they decided to switch to zsh

#

oh no

hollow depot
#

i keep getting an error running this code and opening in browser server_ip:8080 :

const http = require('http')
http.createServer(function(req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.write('miao');
    res.end();
}).listen(8080);```
this is the error:
#

@drowsy crag

hollow depot
summer dune
#

Wow, really? Never seen that range before

#

Where are you hosting it?

hollow depot
#

its an aws linux instance, im not too familiar with this kind of stuff

#

i've tried several things

lyric mountain
#

is that really the public ip?

#

aren't lower ip ranges reserved?

hollow depot
#

i got it on the aws panel, it said "public ip" so ye its the public ip ig

#

lol

summer dune
#

Yeah looks valid

spark flint
#

thats a good ip

cinder birch
#

it could be public ip as far i know

spark flint
#

thats the perfect dns server IP

cinder birch
#

could'nt

summer dune
#

It looked so suspiciously small that I assumed it was a fake local IP lol

#

Are you sure the instance is running? I can't ping it

#

Pinging 3.8.5.4 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 3.8.5.4:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)
#

Ping should work regardless of the application running on it

hollow depot
summer dune
#

can you ssh into it?

hollow depot
#

yup

summer dune
#

Weird

#
C:\Users\colli>curl 3.8.5.4:80
curl: (7) Failed to connect to 3.8.5.4 port 80: Connection refused

C:\Users\colli>
C:\Users\colli>curl 3.8.5.4:8080
curl: (7) Failed to connect to 3.8.5.4 port 8080: Timed out
``` appears to be something there. 80 is refused but 8080 times out
#

Works on my localhost when I run your code locally

hollow depot
hollow depot
#

but 8080 is theoretically open, so idk

summer dune
#

This is EC2, correct?

#

You may need to add inbound port rules

#

For HTTP traffic, add an inbound rule on port 80 from the source address 0.0.0.0/0.
Replace 80 with 8080

hollow depot
#

yes i already have done that

summer dune
#

:/

boreal iron
#

Zero is an integer, yeah

stiff lynx
#

It's normal that everytime that I update the code for a slash commands it need like 5 minutes to update?

stiff lynx
#

that's boring

#

slash commands are trash :/

#

How can I put buttons in my bio like @ Mac or @ Top.gg Gamer ?

solemn latch
#

using rpc

stiff lynx
solemn latch
#

its public, anyone can access it

#

the docs havent been updated in ages

stiff lynx
solemn latch
#

its an api, it has no language.

stiff lynx
#

I have to host it in any way?

solemn latch
#

locally, on your system.

split hazel
#

dont smoke kids

#

anyways does anyone here have any experience with reinforcement learning (ml)

earnest phoenix
#
client.on(intractionCreate
if(int.isButton) {
      
      if(int.customId === ticketOn_${int.guild.id}) {
        await int.reply("Hello") 
      }
#

And i have sent a button with custom id = ticketOn_guildid

#

But it didnt work

lyric mountain
#

didn't u forgor quotes?

#
if (int.customId === `ticketOn_${int.guild.id}`) {
    await int.reply("Hello") 
}
earnest phoenix
#

if you mean curly braces, I didn't forget

boreal iron
#

isButton is a function not a property

lyric mountain
earnest phoenix
#

I was lazy to type that

lyric mountain
boreal iron
#

Probably too lazy to type, too Thonk

earnest phoenix
#

Then what i do?

lyric mountain
earnest phoenix
#

For chck if user clicked button

#
client.on('interactionCreate', async (int) => {
  if (!int.guild) return;
  
  let lang = await db.get("botLang" + int.guild.id) || "english";
  
    if(int.isCommand) {
       const command = client.slashCommands.get(int.commandName);
         if (!command) return;
           await command.run(client, int, lang).catch(async(err) => {
           console.error(err);
           await int.reply({ content: 'There was an error while executing this command!', ephemeral: true });
           }); 
    }
    
    if(int.isButton) {
      console.log("Something is going on")
      if(int.customId === `ticketOn`) {
        console.log("button worked")
        await int.reply("Hello") 
      }
    
    }
  
});client.on('interactionCreate', async (int) => {
  if (!int.guild) return;
  
  let lang = await db.get("botLang" + int.guild.id) || "english";
  
    if(int.isCommand) {
       const command = client.slashCommands.get(int.commandName);
         if (!command) return;
           await command.run(client, int, lang).catch(async(err) => {
           console.error(err);
           await int.reply({ content: 'There was an error while executing this command!', ephemeral: true });
           }); 
    }
    
    if(int.isButton) {
      console.log("Something is going on")
      if(int.customId === `ticketOn`) {
        console.log("button worked")
        await int.reply("Hello") 
      }
    
    }
  
});
boreal iron
#

It’s a function not a property

#

Same goes for isCommand

#

Function not property

#

Is this the same text 2 times or do add multiple event listeners?

earnest phoenix
#

Simple event listener

lyric mountain
#

ye, same text 2 times as it seems

boreal iron
#

I feel like I’m speaking Turkish lol

earnest phoenix
#

I just double click ctrl v

boreal iron
#

Ah alright

earnest phoenix
boreal iron
#

Nvm told you your issue already

lyric mountain
#

you could, like, delete the second part then

earnest phoenix
#

But didnt understand

#

Just tell me like i am dumb

lyric mountain
boreal iron
lyric mountain
#

I mean, it's pretty easy to indentify what is a function and what is a property

earnest phoenix
gritty perch
#

i am very sorry this is off-topic but Is Somehost.xyz Safe ?

earnest phoenix
#

Check comments on google

#

It always help

lyric mountain
#

as it seems, yes

earnest phoenix
#

Quick question is there i.user.reply

#

Nwm try it byself and see result

solemn latch
earnest phoenix
#

I wanna reply who clicked on button

boreal iron
#

Then change your property to be a function

earnest phoenix
#

I just googled

#

Whats different between property and function

#

And i didnt get result

#

So i am ignorant about it rn lol

boreal iron
#

Ok I make it easy

#

Write a function here into the chat

earnest phoenix
#

Basically Properties are used for Design of your class. You can get it is when you are design a page of your class like design a web page there u have properties of the page, controls etc. So the properties are used for design. And function are for executing some action.

boreal iron
#

Doesn’t need to do something

earnest phoenix
#

function x() {
}

boreal iron
#

Correct

#

Now what’s only x

earnest phoenix
#

Yes

spark flint
#

top.gg samsung fridge SDK when?

#

what if I want to host my bot on my smart fridge

earnest phoenix
#

function x(a, b) {
}

#

And that is a and b

boreal iron
#

That’s a function correct

#

How would you define a car called X

#

*var

#

Thanks auto correct

earnest phoenix
#

const X = x

boreal iron
#

Correct

#

Now how do you call the function X?

earnest phoenix
#

X

boreal iron
#

Wrong

earnest phoenix
#

No

#

Property is X

#

Function is x()

boreal iron
#

Finally

#

👍

#

isButton is a function aka. as method in this case

#

Means interaction.isButton()

earnest phoenix
#

Ohhh

#

Okay thanks

boreal iron
#

Same goes for isCommand() or isGuild() etc

#

They are all functions

earnest phoenix
#

But is working without ()

#

Command thing

stiff lynx
lyric mountain
#

remember that for javascript everything is a boolean

#

so bla.someFunction will be true if it exists

#

even if you completely ignored whatever that function is

earnest phoenix
#

So if i do it with () itll be more true?

boreal iron
#

Just add the parentheses

#

To make it a function

lyric mountain
#

if u do with () it'll not be more true, but it'll actually execute the function

boreal iron
#

And the function actually checks if it’s really a button somebody clicked on or not

tardy hornet
boreal iron
#

Returns a bookean

tardy hornet
boreal iron
#

Fuck you auto correct

tardy hornet
earnest phoenix
#
if(int.isButton()) {
      console.log("button worked")
      if(int.customId === `ticketOn`) {
        await int.reply("Hello") 
      }
    }
wheat jolt
lyric mountain
#

errr...a what?

earnest phoenix
#

Still replying message

#

Not user

boreal iron
#

interaction.reply() will send a reply to the channel

#

What do you mean by not user

#

Does reply() still exist anyways in v13

earnest phoenix
#

Like this

boreal iron
#

Doesn’t look v13 accurate

earnest phoenix
#

Tyrone used tickets

boreal iron
#

Still don’t get what’s the issue is

#

The bot can only reply to the original interaction

earnest phoenix
#

Halil replying halil

#

Halil need to reply tyrone

boreal iron
#

He can’t reply to you since you didn’t send anything

#

That’s not how follow up messages work

earnest phoenix
#

Discordjs blocks my dreams

boreal iron
#

You can just send a message to the channel

#

Replying to the original interaction message ID

#

Which will ping you

#

If that’s what you wanna do

earnest phoenix
#

No

#

But its ok

boreal iron
#

confusing

#

Tyrone used ping is a system message by Discord not something you can reply to
Replying to it will send a reply to the message being displayed as result of the ping command

#

That’s how it works freerealestate

visual bone
dapper jasper
#

Hay @boreal iron do you know how to make DMs to a bot work?

boreal iron
#

It’s just a normal channel

dapper jasper
#

Cuz right now I realized you can only reply if a bot sent you a message

dapper jasper
lyric mountain
#

dms are channels

#

just not guild channels

boreal iron
#

You can click on the bot and it appears this small profile box

#

It includes a text field to send a message to the user or bot

dapper jasper
boreal iron
#

You mean it messes the event if it’s offline and come back online?

dapper jasper
#

Scam

boreal iron
#

Receiving the event while it’s offline?

dapper jasper
#

And then it all gets reset when you restart the bot and the event goes back to not being triggered

boreal iron
#

Huh the event should always be triggered if somebody sends a message to the bot

#

The bot doesn’t need to reply or send a message in the first place

#

Not sure if that needs a specific intent tho

#

But I don’t think so

dapper jasper
boreal iron
#

Anyways whenever your bot receives a message it will trigger the event

boreal iron
#

Don’t know a reason why it shouldn’t

#

Sounds like a discord issue or something I’m not aware of

#

Maybe Kuhawkabunkaugu has an idea

#

@lyric mountain

lyric mountain
#

?

#

never had such issue

gritty perch
#

@spark flint i am using repl for my bot coding , can i host my bot on somehost.xyz ?

#

BTW sorry for ping

earnest phoenix
#

I need so confusing contructor help

coral palm
#

a

spark flint
stiff lynx
#

inter.reply( { embeds : [aiuto] } ).then(sent => setTimeout(() => sent.delete(), 2000))

#

why this doesnt work?

slender thistle
#

So yes, it is included

#

Just not on its own

stiff lynx
#

const text = inter.options.getString('testo').join("+");

how can I fix this?
Idk how to fullfill blank spaces with '+'

boreal iron
#

Join is concating items of an array to a string

#

What you’re looking for is replace()

#

Using a regex to replace all spaces

stiff lynx
#

.replace(' ', '+')

#

like this?

boreal iron
#

replace(/ +/g, "+")

#

Must be a regex with accurate flags to replace all spaces not only one

#

It will also replace multiple spaces with one + only

stiff lynx
#

tysm

boreal iron
#

👍

limber mica
#

I got no ideas on what to make...

#

I need something

#

:/

summer dune
#

For all whitespace

boreal iron
#

Yeah if you wanna include each whitespace type that makes sense

#

Don’t think TABS or line feeds are a thing a client can enter in Discord but Unicode whitespaces are a thing

lament rock
#

You can enter tabs

boreal iron
#

I mean they won’t be delivered as content

#

They will end up being a normal whitrspace

lament rock
#

weird

boreal iron
#

Or does the API send tabs in the content?

#

I don’t think so

lament rock
#

I just checked and either the client strips it or the server strips it. Likely that the server strips it since it strips a lot from content

#

Lemme check if my bot can send tabs

#

the server strips it

boreal iron
#

I mean they can be used in code blocks

lament rock
boreal iron
#

Not sure if they will be converted to whitespaces tho or not

#

Brb

limber mica
#

Anyone got any good ideas for smthn to make?

lament rock
#

For bots, you could do a:
text based rpg.
natural language chat bot
or maybe look at other things people need for their servers

boreal iron
lament rock
#

It's being stripped to 2 spaces

boreal iron
#

Oh

#

Does the same happen for Unicode tabs?

limber mica
boreal iron
#

Can’t test it atm unfortunately

limber mica
#

hmmmm

#

What if i do a multi utility

#

So I can experiment with auths

boreal iron
#

@lament rock

lament rock
#

I have no clue what a unicode tab is or why that's relevant or who even uses such a thing if regular tabs exist

boreal iron
#

Just wanted to make something sure but nvm

#

Can’t test it on mobile myself

earnest phoenix
#

In my slash commands, it says: DiscordAPIError: Missing Access

#

Totally new to Slash Commands.

#

Nevermind, it was in the OAUTH2 link

proven lantern
#

anyone here a pro with the next dynamodb v3 nodejs library? i am getting an error with this code.

frigid burrow
#

idk js just python

proven lantern
#

noice

lament rock
#

very helpful. take my reddit gold

frigid burrow
#

yes

proven lantern
#

this is the old nodejs library code and it's working

#

the get query works

lament rock
#

I'd prob read tutorials

earnest phoenix
#
@client.command()
async def rank(ctx):
  user = ctx.message.author
  with open('users.json', 'r') as f:
    users2 = json.load(f)
  lvl = users2[str(user.id)]['level']
  embed = discord.Embed(
    title = "做得好!!",
    description = f"你有 {lvl} social credit!",
    color = discord.Colour.green()
  )
  embed.set_thumbnail(url=ctx.author.avatar_url)
  await ctx.send(embed=embed)

Ok, So I get this error upon executing the command and im not sure why. (yes, I know json is not the best way todo this. Its for a single server, so im sure its probaby fine)

lament rock
#

Some people go down obscure rabbit holes

#

The JSON isn't formatted correctly

earnest phoenix
#

I see

#
{"765628740402282517": {"experience": 138, "level": 3},
#

here is an example of how it is formatted

lament rock
#

l1 c1 is expecting a { or a [

#

Or the file isn't properly balanced

proven lantern
earnest phoenix
#
{"765628740402282517": {"experience": 138, "level": 3}, "630472664510627850": {"experience": 42, "level": 2}, "490263061991653396": {"experience": 18, "level": 2}, "836111723999526942": {"experience": 12, "level": 1}, "462912345325174804": {"experience": 42, "level": 2}, "720648253372366898": {"experience": 12, "level": 1}, "801905232266788894": {"experience": 168, "level": 3}, "677524295735443479": {"experience": 6, "level": 1},
"165860118548840448": {"experience": 6, "level": 1}}
``` it all seems correct
#

™️

lament rock
#

Seems correct to me as well. It is properly formatted and balanced. But a JSON decode exception wouldn't be thrown unless the json.load is actually parsing the string passed to it or the path supplied is incorrect. Idk python much, so I can't be of much help and I'd possibly suggest looking up the error on google and tutorials for the json module

earnest phoenix
#

The weird thing is if I define the variable not in the command it works just fine

lament rock
#

Yup

#

that's it. load expects a string to parse

earnest phoenix
#

But that does not update every time you do the command