#development

1 messages · Page 1969 of 1

woeful pike
#

yes

quartz kindle
#

for example, if i want to know what were the coordinates of a planet or star in a specific date 500+ years ago

#

first of all the gregorian calendar didnt exist back then

#

they used the julian calendar

#

then they didnt have a constant methods of time keeping like clocks, they used sundials and sun based stuff, aka apparent/solar time

#

so any important date you find in history books is likely gonna be recorded as apparent time in the julian calendar

#

so you have to convert all that crap to something modern first

trim perch
#

and pray they're using the same system

quartz kindle
#

they didnt have timezones either

#

so you have to assume their "local solar time" from the geographical longitude

#

(which honestly its easier than all the timezone crap)

lyric mountain
#

Remember gregorian calendar technically has a 13th and 14th months

#

Undecimber and Duodecimber

earnest phoenix
#

0x1F so what is this caleld again? Cause elixir treats it as an integer

quartz kindle
earnest phoenix
#

ah right

wheat mesa
#

wow mist

#

big brain

lyric mountain
quartz kindle
#

Historian Cassius Dio tells that Licinus, procurator of Gaul, added two months to the year 15 BC, because taxes were paid by the month.[5] Though not named by Dio, who wrote in Greek, August Immanuel Bekker suggested these might have been called "Undecember" and "Duodecember".[citation needed]

earnest phoenix
lyric mountain
#

Ah yes, taxes

quartz kindle
#

always damn taxes

lyric mountain
#

So they could milk +2 months worth per year

wheat mesa
#

reverse the a and e

earnest phoenix
#

texas sucks

#

kthxbai

wheat mesa
#

true

earnest phoenix
#

also waffle aren't you supposed to be gaming rn

#

go away

ebon bison
lyric mountain
#

Isn't texas just an arid shrubland with small towns where people shoot eachother at noon while wearing cowboy attire?

ebon bison
#

anyone want to clone any server dm

#

me

lyric mountain
hybrid cargo
lyric mountain
#

Don't ads please

ebon bison
#

any server

#

v

ebon bison
trim perch
#

Texas does have a thing for cowboy attires though

#

You'll see guards at the mexican border whipping people to stay out while riding a horse

lyric mountain
#

And spitting tobacco on bins

trim perch
#

that sell guns

lyric mountain
#

Do you pet tumbleweeds?

wheat mesa
#

no

#

we adopt them

earnest phoenix
#

no we eat them

elder jewel
#

Does anyone know of a list of sussy nitro scam links?

trim perch
#

Doesn't Discord host their own?

craggy pine
#

Javascript question:

Lets say I have args from a card lookup command. First thing I need to match is a category from a json of categories.

console.log(args)
//[ 'Final', 'Fantasy', 'TCG', "y'shtola" ]

The match for the category would be [ 'Final', 'Fantasy', 'TCG' ] as that's the name of the category and "y'shtola" as the name for the card

I can already set the variable for category no problemo by just setting category to the json category name.

how could I get the content after the category so I can set it to a variable named cardName?

Category can be many lengths with spaces and so can cardName

pale vessel
#

Is the JSON data big? How many cards are there?

#

This looks pretty inefficient but it works

craggy pine
#

this is what the categories would look like if you were wondering. The card is not important in this case just returning basically what you did while. [category, cardName]

#
{
    "Categories": [
      {
        "CategoryId": 4,
        "Name": "Axis & Allies"
      },
      {
        "CategoryId": 5,
        "Name": "Boardgames"
      },
      {
        "CategoryId": 16,
        "Name": "Cardfight Vanguard"
      },
      {
        "CategoryId": 6,
        "Name": "D & D Miniatures"
      },
      {
        "CategoryId": 18,
        "Name": "Dice Masters"
      }
  ]
}
#

It's longer however

hybrid cargo
#

Loop through each object inside the Categories array and create a regex with the category name. Match it with the joinedArgs. If it matches, assign the matched string to category and break out of the loop and then slice joinedArgs with category.length to get the card name

craggy pine
#

Probably more inefficient than what flaz said but this is how I did it

            let category
            let check = args.join(" ")
            for(i=0;i<cat.length;i++) {
                if(check.toLowerCase().includes(cat[i].Name.toLowerCase())) {
                    category = cat[i].Name
                }
            }
            if(!cat.map(item => item.Name).join("\n").includes(category)) {
                const errorEmbed = client.extends.errorEmbed(`I could not find the category that you searched for!`)
                message.channel.send({embeds: [errorEmbed]})
            } else {
                let cardName = check.slice(category.length + 1, check.length)
            //More code...
pale vessel
#

Better off using ```js
const check = args.join(" ").toLowerCase(),
category = cat.find(_cat => check.includes(_cat.Name.toLowerCase()));

#

Or at least break the loop once you find the correct cat since it'd just continue looping for no reason otherwise

craggy pine
#

I'll try ur first example really quick but ya I forgot to break lul

pale vessel
#

!cat.map(item => item.Name).join("\n").includes(category) could be changed to just !cat.some(item => item.Name === category) to avoid unnecessary mutation

loud tree
#

i am new to java, my friend is getting this as an error

#

any soln.?

craggy pine
pale vessel
#

It's like array.includes() but it takes a function instead of string

craggy pine
#

Oh neato

earnest phoenix
#

Well you are already off to a bad start if you think that is java

loud tree
#

js

#

mb

#

;-;

#

wait

#

wtf

#

sorry

earnest phoenix
#

Also why are you trying to use for each on an array with one element

loud tree
#

lemme send you correct code

#

here it is

craggy pine
pale vessel
#

Like cat.find(_cat => check.includes(_cat.Name.toLowerCase()))?.Name;?

craggy pine
#

ah yep

#

Ty

#

I need to study more on this kinda stuff. I would've never figured out .? would have been a thing either kittyLOL

pale vessel
#

True

#

Optional chaining is super convenient

craggy pine
#

noted for the future

#

Everything works as it should with your code.

near stratus
#

Doesn't seem like no reason to me
Also wrong channel

loud tree
#

eww

rocky hearth
#

can't I publish public packages to npm with names like this @blah/dlah?

pale vessel
#

you can

rocky hearth
pale vessel
#

it needs to be your username

surreal sage
#

Hi, my name is stupid.

To the point, I forgot what npm module could create a executable (and no, not react)

#

nvm electron

sand crown
#

I think you should try to specify the language and what the errors are 🙂

rose warren
#

Show your package.json code

#

Sorry. I was busy somewhere else. Try to validate your package.json with https://jsonlint.com/

#

Yeah you're missing : after start

hybrid cargo
#

for reference, obj is the object that the guy sent in here 👀

raw nest
#

What's the purpose of Database Col Types? Like just to only have specific type of values in it?

split hazel
#

did you mean: BTEC rust

rigid maple
#

no just R

#

R is a programming language for statistical computing and graphics supported by the R Core Team and the R Foundation for Statistical Computing. Created by statisticians Ross Ihaka and Robert Gentleman, R is used among data miners and statisticians for data analysis and developing statistical software. Users have created packages to augment the f...

daring apex
rigid maple
split hazel
#

maybe post your question instead of asking, it might be something general or something someone that doesn't know R can work out

#

you could've gotten an answer twice by now

rigid maple
#

Hello, I am trying to make a system that performs voice-gender analysis. I found a project about this on github but I'm new to R so I have no idea what to do. I'm building my project using node.js and using the r-integration module to include R. Since I can't find which function to enter the sound file in, I can't get the output correctly either.

https://github.com/primaryobjects/voice-gender/tree/master/Web

GitHub

Gender recognition by voice and speech analysis. Contribute to primaryobjects/voice-gender development by creating an account on GitHub.

#

I imported 2 files into my own project (gender.R, server.R)

#

In this project, it reflects the output to the website, but my purpose is to log it to the console.

#

(translated by google translate)

feral aspen
#

Hey, everyone. I would like to ask that I have this mapped data code:-

const mappedData = Object.keys(inventory.inventory)
    .filter(key => inventory.inventory[key] !== 0)
    .map((key) => {
        const { name, id, logo } = items.find((val) => val.id === key.toLowerCase());
        return `${logo} **${name}** ─ ${inventory.inventory[key].toLocaleString()}\n**ID:** \`${id}\``;
    })
    .join("\n\n")

Although, sometimes, items.find((val) => val.id === key.toLowerCase()) can return undefined due to some coding reasons, how can I add a filter that if it was undefined, then it would contine or skip since I can't seem to figure it out.

cinder patio
#

There isn't an easy way

#

I would just write a single for loop, or if you want to do it this way then make sure the item exists beforehand, possibly in the filter callback

quartz kindle
#

yeah get rid of that double loop in there, terrible performance

#

find inside map is bad

cinder patio
#

Maybe create a Map beforehand so it's faster

#

you'll have && map.has(key) in the filter

#

it depends on how big the data is tbh

trim perch
#

copilot just breaks half the time

elder jewel
#

Does anyone have a list of malicious links

#

Private message me it please

#

Thank you.

pine nova
spark flint
#

make your life easier

#

direct link to the json

pine nova
#

💀

elder jewel
#

Yall hella epic

#

know any other lists?

trim perch
#

lol the list

elder jewel
#

never trust the .xyz xd

#

I wonder how they collected them

#

or did they just use a AI to guess what they might be

trim perch
#

probably just requests from users

quartz kindle
#

what about discord fishing links?

elder jewel
#

what about them

#

i dont think discord offers fishing lessions

#

unsure though

quartz kindle
#

in case we want some fish

cinder patio
#

discord sells fishing hooks?

trim perch
#

the one that got me is on the list

cinder patio
#

how can you fall for this

lament rock
#

🦀

trim perch
boreal iron
split hazel
#

fun fact shifting bits to the left or right is an optimised way of dividing/multiplying by 2

trim perch
#

disabling javascript cringe

split hazel
#

pov you disable javascript in 2022

boreal iron
#

Yeah that should be the default policy on any site, no exceptions

trim perch
#

yuck

#

imagine having to enable that for each site I visit

#

that's just annoying

#

and so many sites depend on more javascript today

#

unless you're google

split hazel
#

think of the electricity savings tho

#

and memory usage

trim perch
#

we have gigabytes worth of memory

boreal iron
trim perch
#

yet we scream at developers who add 10 kb for an animated header

split hazel
#

people that call themselves front end devs can't write javascript properly

trim perch
#

while turning a blind eye to steam games taking 200 gb of storage

split hazel
#

sounds like a unity dev intern

#

oh wait

trim perch
boreal iron
#

How does that matter when being too lazy to enforce security?

trim perch
#

we have many other means of security

boreal iron
#

This is the answer

trim perch
#

e.g. deceptive site warning

#

bad answer

boreal iron
#

Why do think is flash gone?

split hazel
#

because slow

trim perch
#

because steve jobs killed it

boreal iron
#

Just another example of an huge security hole

split hazel
#

among us is a data miner

boreal iron
trim perch
#

why do you think most browsers enable it by default

#

because they know there's much more content the user cares about that supports javascript

winter pasture
# elder jewel never trust the .xyz xd
trim perch
#

the stuff the user cares about as opposed to enabling it each time

elder jewel
trim perch
#

"enable javascript pls" for the user is just settling for average security

#

and relies on the user not being ignorant

boreal iron
trim perch
#

cough dm scams

winter pasture
#

I got JavaScript disabled by default

#

Surprisingly works fine most of the time

boreal iron
#

Aye it does

winter pasture
#

There should be no reason to have JavaScript most of the time

#

Just a few annoying sites that still does client side react

boreal iron
#

You gotta enable it for sources you trust without any exceptions

proven lantern
#

is java going to fail in the lambda space for the same reason it failed with applets?

split hazel
#

yes

trim perch
lyric mountain
#

lambda space?

proven lantern
#

aws lambdas, cloudflare workers, etc

lyric mountain
#

ah, you mean it doesn't work there?

proven lantern
#

yeah, because of cold starts

#

i thought java failed with applets because it was so slow

trim perch
#

thought you were talking about function lambdas, like (x) -> x

lyric mountain
proven lantern
#

maybe serverless is a better term

#

serverless means it scales from 0 instances right?

trim perch
#

dynamic scaling it seems

#

add and reduce resources for demand

#

java does have slow startup time

#

some things like graalvm improves it

lyric mountain
#

you can increase the minimum heap size

#

that'll make the jvm start with more resources loaded

proven lantern
#

wouldn't that make it take longer to load?

lyric mountain
#

not really

#

like, the jvm start time will be the same, but it'll run whatever ur running in it faster cuz it'll unload less stuff

#

usually you want to set -Xms based on your available ram

#

instead of leaving it at bare minimum

#

there are also a lot of optimization args you can use

proven lantern
#

i guess it wouldn't slow it down. it's just claiming the ram, not actually doing anything to it initially

lyric mountain
#

ye

proven lantern
#

the hello world aws lambdas for java use 512mb and the nodejs use 128mb

lyric mountain
#

lower xms means the GC will collect more stuff due to lower bottom limit

proven lantern
#

lambdas can help hide java memory leaks too

#

because they shut down and spin up all the time

#

and nodejs memory leaks

#

the GC is shutting down the instance

lyric mountain
#

also, set the gc to zgc

#

default jvm gc is shitty for servers

proven lantern
#

google needs to work on the jvm

lyric mountain
#

zgc is zero-latency garbage collector, it doesn't halt the runtime

proven lantern
#

but oracle sued them

lyric mountain
#

there's also shenandoah depending on ur jvm version

lyric mountain
proven lantern
#

and now java is dying

lyric mountain
#

tbh it's been a looooong time since I used oracle's jvm

lyric mountain
proven lantern
#

google wanted to make a nicer version of the java api

#

like micro java or something

lyric mountain
#

and apache is leading the groovy project

#

also isn't kotlin google's?

trim perch
#

JetBrains's

proven lantern
#

intellij

#

yeah

lyric mountain
#

oh, now kotlin has +10 social credit with me

trim perch
#

but you use intellij

#

-500

proven lantern
#

this is an interesting thing about java

#

about the try/catch/finally issue with java

#

and the type system

lyric mountain
#

tcf issue?

split hazel
#

the exception system makes me hate java more than i already do

#

it forces you to explicitly label/handle exceptions

lyric mountain
#

not really, there are 2 types of exceptions

split hazel
#

that is a good thing but annoying

lyric mountain
#

Exception is for exceptions that are expected to happen if you fck something in the code

split hazel
#

"runtime exceptions"

lyric mountain
#

while RuntimeException is something that might happen due to user input

split hazel
#

what i was referring to

#

you have to either try catch or do "throws xyz"

lyric mountain
#

runtimeexceptions don't require try-catch

#

nor throws

split hazel
#

then idk

lyric mountain
#

you're talking abt Exception

split hazel
#

something like threadsleeptimeout

lyric mountain
#

that's Exception, specifically InterruptedException

lyric mountain
desert hazel
#

Hello Fellow coders
i am in dire need of assistance
updating java onto a debian machine
is anyone able to help me pelase

earnest phoenix
#

help

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: unban_error() missing 1 required positional argument: 'error'

#

i can't seem to fix this

desert hazel
#

okay

trim perch
# lyric mountain ^ that's why it requires try-catch/throws

I think the complaint is the design choice of handling exceptions. Some methods have checked exceptions, some are unchecked. Some methods return signal codes rather than exceptions (e.g. indexOf), while the others just throw and break the control flow.

#

Personally, I like languages where exceptions are a last-case scenario only in cases of emergency, like Rust where you have an Error enum (treat it like any other enum), or you can panic!, which acts external.

split hazel
#

i dont use rust but it sounds interesting

trim perch
#

Sure, though I was slightly wrong—Rust has a Result type.

use std::fs::File;

fn main() {
    let f = File::open("hello.txt");

    let f = match f {
        Ok(file) => file,
        Err(error) => panic!("Problem opening the file: {:?}", error),
    };
}

f is a Result containing either a value (Ok), containing a file, or an error (Err), containing some value (usually from the Error struct).

In the code, f will only be a File because if an error occurred, the program would've panicked (crash). Most people just let errors propagate and be handled explicitly.

#

With the system, you don't have to consider if some call will throw an exception since there's no throwing. You handle the error explicitly.

earnest phoenix
#

Rust seems like an interesting language to learn I just dont have the mental capacity to stay focused to learn it

trim perch
#

don't worry most of us don't

#

Rust is interesting, but I'm mostly building applications that'll be used by general users

#

All the low-level capabilities and "blazingly fast" technology is simply not a necessity.

cinder patio
#

Rust also has the ? operator which makes error handling sooooooooooooooo much cleaner and easier

trim perch
#

Yeah but you're just delegating the problem to someone else

cinder patio
#

yeah, handle all ur errors in one place

trim perch
#

That sounds good on paper but usually doesn't work in practice.

#

Since you're in such an abstract position where you can't.

cinder patio
#

sloppy error handling is the worst

#

I dunno I've used it quite a lot in practice

warm swan
#

How do i move that up there?

modest maple
#

flex box html is probably easiest

#

or grid

#

(you need HTML)

warm swan
#

can u give me an example?

#

i don't really code in html

#

i just tried making a desc

#

that's it

#

but like idk anything ab it

modest maple
#

research™️

#

it takes 10 minutes to have a read and a play

warm swan
#

that's what i did

#

i couldn't find out

#

how else do u think i made this "desc" 😂

#

without knowing anything in html

modest maple
#

doubt research how to use a flex box or grid layout

#

it again, takes 10 minutes

warm swan
quartz kindle
#

or just a simple inline-block?

modest maple
quartz kindle
#

lel

warm swan
#

For some reasons i find it kidna rude lol

#

kinda

#

i literally said i don't know anything about html

modest maple
#

so what a perfect time to learn

warm swan
#

i am not really planning to learn it

#

i just want to build a description

modest maple
#

well then you may be out of options shrug

warm swan
#

If u say so 🤷‍♂️

timid hemlock
#

how -1064

lyric mountain
#

when the server access you

#

but well, you probably flipped the formula

#

it's current - before not before - current

lament rock
#

negative response time is still possible because of Snowflake timestamps

#

something something discord is weird

modest maple
#

You litterally cannot have a negative latency, time does not allow it

elder jewel
#

anyone have any massive lists of phishing links?

lament rock
#

I've gotten negative latency even with the correct formula

#

I think it depends on if you hit when machines are synchronizing their time

modest maple
#

How df are you messuring latency

lament rock
#

createdTimestamp and edited timestamp

modest maple
lament rock
#

Discord doesn't have a nuclear clock it seems

modest maple
#

And you do this to measure the REST latency or the WS latency?

lament rock
#

rest

#

ws is measured by acks

modest maple
#

and you take the timestamp differences instead of just measuring the Round trip latency which is the thing you actually care about because??

lament rock
#

Yeah. Of course I have to await them so it is round trip

modest maple
#

what

lament rock
#

message = await send(stuff)
update = await edit(newStuff)
edit(update.editedTimestamp - message.createdTimestamp)

#

not exactly that but im on mobile so

#

that example is bidirectional

#

Discord has to respond right?

elder jewel
#

anyone have any massive lists of phishing links?

trim perch
#

why do you keep asking this

elder jewel
#

cus i need more xd

cinder patio
#

why???

elder jewel
#

trainin AI

modest maple
#

gOTTa mAKe the MOD bOt

cinder patio
#

You don't really need an AI to detect links similar to discord's

modest maple
#

mate you got a better chance just using the defacto spam detection algorithm than trying to do some fancy AI based purely on links

elder jewel
modest maple
#

its not pog

cinder patio
#
  • levenshtein distance between the name of the site and "discord"
  • If the domain name is not .com

Is enough to detect a scam link

trim perch
#

a personal, generic discord bot

#

just for whatever server I want it in

#

like my own

#

it's mostly just information, like retrieving a user's avatar, trivia, wikipedia articles, etc.

modest maple
trim perch
#

nah, not python

#

felt like using something else

hidden gorge
#

Error

      if (command.aliases.length === 0) command.aliases = null;
                          ^

TypeError: Cannot read property 'length' of undefined```

Code: https://www.toptal.com/developers/hastebin/kisoluqopi.js
trim perch
#

error is command.aliases is undefined

#

so you should figure out why it's not set sometimes

hidden gorge
#

i have client.aliases = new Discord.Collection();

trim perch
#

e.g. you didn't export it

#

but that's independent of a command

hidden gorge
#

omg

boreal iron
#

A collection is no array

#

It has a size not a length

hidden gorge
#

then what do i do?

boreal iron
#

Just read my second sentence

#

It’s basically a map, which also has no length property but a size

trim perch
#

That's not the root of the problem though

#

And I doubt command.aliases is actually a collection

#

It's common for people following a Discord.js guide to make the global aliases a collection but export aliases as an array

boreal iron
#

I guess command.aliases is one too then since we don’t know better

#

But yes it’s just guessing until he’s telling us more

trim perch
#

99.9% sure they're using an array

#

given (client/command).aliases

#

what does an alias attached to a command have to point to

boreal iron
#

Yeah it is just checked his link

#

It’s probably at least one command he loads without an alias defined in the structure

hidden gorge
#

ah

#

well I did add a new Help command

#

it started having the issues when i added the new command

#

I think i found it

#

yep i found my issue

boreal iron
#

You didn’t define aliases in its structure

hidden gorge
#

yep

boreal iron
#

Also remove the statement from your code

hidden gorge
#

I FIXED IT!

boreal iron
#

if(command.aliases) …
else command.aliases = null;

#

You should always be consistent in your module structure

#

If no alias exists then define aliases: null in the module

#

Checking for each property of the module in your code when loading it is inefficient.

#

Keep the structure consistent, always

#

Or you will run into the same issue next time you do forget an alias again

hidden gorge
#

@boreal iron I forgot to add js aliases: [], In my New Commands I coded

boreal iron
#

I know freerealestate

#

That’s what I said

hidden gorge
#

when i added it to the commands it worked

boreal iron
#

if(command.aliases) …
else command.aliases = null;

hidden gorge
#

And I got this in my Output So I knew it worked
⚠️ I am in 5 Servers ⚠️ ⚠️ and I am in 113 channels ⚠️ ⚠️ and 37 Users use me ⚠️

trim perch
boreal iron
#

Edit line 74/75

#

Can’t actually see which one is the right one on mobile lol

hidden gorge
#

My bot sends a Incoming Request to one of my webhooks and It tells the webhook what to send and every time My command works i have it logged in a channel saying
"Command Was Registered and was Successful "

boreal iron
hidden gorge
#

Yeah My commands Only work if the Module is written in my Index

#

And sometimes i am an idiot and forget to add the module in my index

boreal iron
#

I mean we could go on and step through your code but hmm… no time to

#

Also think about to not listen two times to the same event

#

You have 2 event listeners for message events

split hazel
lament rock
#

Trolled a game dev scammer. Was fun to know that they're really dumb when it comes down to actual code stuff

boreal iron
#

I mean wtf

boreal iron
#

Looks like it’s line 74,5

faint pasture
#

why does this say unexpected indent?

crimson vapor
#

because the intent was unexpected

trim perch
#

because python cares about indentation

#

indentation creates scope

#

your scope is where await is

#

yet you've indented it by two blocks, creating a different scope

faint pasture
#

what does this mean?

spark flint
#

its the indent

trim perch
#

you're supposed to remove the indentation

spark flint
faint pasture
#

ok thank you

exotic meadow
#

im trying to make a system to where it checks a verification status via http request. the request is contained in a function and i set the function equal to a variable named status. the issue is the code is running before the function returns a response making it an undefined promise. how can i make the program wait until it receives a response?

code: ```js
let status = await verify(message.author.id)
console.log(status)
if(status === "error") {

        const collector22 = m1.createMessageComponentCollector(filter, { componentType: 'BUTTON', time: 200000 });
        collector22.on('collect', async (i) => {
            if(i.customId === 'continue_verify') {
                status = await verify(message.author.id)
                if(status === "error") {
                    console.log('g')
                    err(message)
                } else {
                    console.log('h')
                    next(status, message)
                }
            } else {
                console.log("hh")
                next(status, message)
            }
    })```
trim perch
#

You could check if Discord.js provides a simpler method than createMessageComponentCollector, like how they have .awaitMessages that returns a promise resolving to the messages returned.

exotic meadow
#

The issue isn't with the collector, its that the code is running before it gets the response from the verify() function.

trim perch
#

Yes, and that comes from using verify with the collector callback.

#

Like I said, you can either do what I said above, or you could programmatically create a promise yourself and wait for it to be resolved.

exotic meadow
#

Alright I'll look into it.

faint pasture
#

why is this invalid syntax?

trim perch
#

same reason as before

#

probably

faint pasture
#

does it need indent

trim perch
#

could you show more code

#

what are you trying to do

faint pasture
#

it says unexpected indent afterwards

#

its basically a command like the dank memer post meme just adjusted

faint pasture
trim perch
#

You should put as much details as possible that you think is relevant to your problem

#

But this may be due to something missing to pair the else: with and/or an indentation error.

#

Usually you'll use else: with if: or try:

#

e.g.

if day == "Friday":
  print("Yeah, Friday!")
else:
  print("I hate my life.")
#

What does else: in your code pair with?

faint pasture
slow terrace
#
          const modifier = require(`${process.cwd()}/util/modifier`);

          const message = await modifier.modify(`{user}, Joined the server`, member);
          return client.channels.cache.get(data.greeter.welcome.channel).send(message);

../util/modifier

const moment = require('moment');

async function modify(str, member){

  const owner = await member.guild.members.fetch(member.guild.ownerID);
  const modifiers = {
    "{user}": member.user.username,
  };
  const regexp = new RegExp(Object.keys(modifiers).join('|'), 'g');

  return str.replace(regexp, word => {
    return modifiers[word] || word;
  });
};

module.exports = { modify };

user should be the member.user.username but for some reason it's nothing (it was working before!)
any help?

daring apex
#

Can anyone can help

dry imp
#

yea i can

#

its on line 69420 there is a wrong indentation

daring apex
#

But am on line 12

dry imp
#

joke how would i know you dont share the code

daring apex
#

import discord

client = discord.Client()

@client.event
async def on_ready():
print('we have logged in as (0.user)'.format(client))

@client.event
async def on_message():
if message.author == client.user:
return

if message.content.startwith('$hello')
await message.channel.send('Hello')

client.run()

#

@dry imp

dry imp
#

and dont ping multiple times

daring apex
#

No

#

That's why am asking

#

Because

pine nova
#

💀

dry imp
#

you know how to code in python?

daring apex
dry imp
#

you should learn the basic first

daring apex
#

Ok

dry imp
#

indentation is very simple and if you dont know what indentation is then you should start with somethn simple first

pine nova
# daring apex import discord client = discord.Client() @client.event async def on_ready(): ...

u need to indent the return statement under the if statement. like press tab before the return statement smthing like that check this out https://www.educba.com/indentation-error-in-python/#:~:text=The indentation error can occur,can be a show stopper.

wheat mesa
#

python is beginner friendly, they said...

pine nova
#

lol

#

it is

#

ig

dry imp
#

unless you are a beginner expecting to get spoonfed

wheat mesa
#

mfw indentation causes errors

dry imp
#

semi colon causes erros

#

lmae

#

lame

pine nova
#

python has semi colon? 💀

wheat mesa
#

Python has optional semicolons

#

Not really used tbh

pine nova
#

never used it yea

wheat mesa
#

It’s just a thing that helps if you’re a psychopath

pine nova
#

💀

wheat mesa
#

Indentation is one of the main reasons I hate python so much

dry imp
#

bruh

#

its auto indent and even if its not its as easy as pressing tab

wheat mesa
#

Makes it harder to see unintended behavior

#

“I wanted this variable in this scope but I accidentally put it in the wrong scope and didn’t know why my program wasn’t working properly”

dry imp
#

well the solution is get good

#

works everytime

wheat mesa
#

The solution is don’t use python

#

Works every time

dry imp
#

naa

pine nova
pine nova
pine nova
#

yea

woeful monolith
#

But if you copy paste

pine nova
#

i see

earnest phoenix
#

How do you handle guilds,which use your bot for abusive stuff? Since I have a guild,which used it for an acc shop.So I just disconneted all listeners for the guild.

daring apex
#

Umm

#

Can I anyone can tell me

#

How to add .env file

wheat mesa
round cove
#

Not the doge pfp viviooaahh

round cove
#

Long story.

round cove
daring apex
#

Ohh

pine nova
pale vessel
wheat mesa
pine nova
earnest phoenix
#

thats how it look likes

round cove
#

Do you have an eval command?

earnest phoenix
round cove
#

If you have the guild Id you can force the bot to leave it.

earnest phoenix
#

so its not my problem,that they used our bot for malcious stuff?

round cove
#

I mean you gave Discord your ID right lol

#

Probably make a TOS and say Do not use bot for X stuff blah blah legal stuff. But I imagine you have liability for this especially since you know about it.

daring apex
#

Replit laging again topggSob

earnest phoenix
#

yeah we have a tos and policy
"Any type of Selfbotting or Misusage of our Bot is strictly prohibited

You are not allowed to break the Discord TOS or third-party TOS.

""

daring apex
#

import discord
import os

client = discord.Client()

@client.event
async def on_ready():
print('we have logged in as (0.user)'.format(client))

@client.event
async def on_message():
if message.author == client.user:
return
if message.content.startwith('$hello'):
await message.channel.send('Hello')

client.run

#

Can anyone can tell whats worng with it 😑

pine nova
#

client.run should be a method

#

not a property

#

ig

#

what error u getting tho

daring apex
#

Wait

pine nova
daring apex
pine nova
#

oh

daring apex
#

It's because of laging

pine nova
#
if message.content.startwith('$hello'):
  await message.channel.send('Hello')
``` this line is outside of ur on_message event
#

ig

#

thats why

daring apex
#

Ohh

#

I will do it later

#

🥱

wheat mesa
#

I don’t know how py libs work very much, but shouldn’t it be on_message(message):?

pine nova
#

yea

daring apex
#

Ummm

#

To create .env file do we have to create sectret and name the key .env file ???

dry imp
#

name the key your key

earnest phoenix
#

homie doesn't even know how .env files work?

daring apex
#

Hummmm

#

Ok

pine nova
earnest phoenix
round cove
earnest phoenix
earnest phoenix
dry imp
#

homie doesnt know what is key and value tho

pine nova
#

env is just like objects/dictionaries just a lil diff

#

💀

earnest phoenix
dry imp
pine nova
earnest phoenix
#

Oh i didnt see he is using py

earnest phoenix
earnest phoenix
daring apex
#

Ohh

dry imp
#

but ill help you anyway

dry imp
#

name it TOKEN

#

value is your token

earnest phoenix
#

let's make it a rule to always slap whitenames with the docs

dry imp
#

os.getenv("TOKEN")

#

import os ofc

dry imp
#

child

earnest phoenix
#

a fake bash terminal in html

earnest phoenix
pine nova
#

ur mom

pale vessel
#

your mom

pine nova
dry imp
earnest phoenix
#

Me

#

Yes

#

mee6 is great

pine nova
#

why its bad tho

earnest phoenix
#

Pay to use

pine nova
#

o

#

lol

pale vessel
#

at this point mee6 is better than carl-bot

earnest phoenix
pale vessel
#

they fucked carl-bot real bad

earnest phoenix
#

And only feature is dashboard

pine nova
#

F

pale vessel
#

ever since botlabs owned it

earnest phoenix
pine nova
#

there must be some

#

free commands

#

too

pine nova
#

💀 imagine listening to music on discord

earnest phoenix
#

Think it

pine nova
#

well

dry imp
#

imagine not using adblock

pine nova
#

just download the mp3 files

#

yea

earnest phoenix
pine nova
#

but discord vc the quality is shit

earnest phoenix
#

no flex but opera's sidebar player can skip spotify ads

#

If i add music bot ill have better music bot
And I don't have to lose my pocket money to mee6

pine nova
#

thanks for info

earnest phoenix
pine nova
#

i still use chrome 💀

#

cuz i have sm

earnest phoenix
#

gonna get banned soon

dry imp
#

adblock can remove spotify ads lmao

earnest phoenix
#

I am not listening music on discord just an example

pine nova
#

important bookmarks

earnest phoenix
#

what does it use then

#

SoundCloud

pine nova
#

if u want to play music with no ads

#

use

#

youtube

#

vanced

earnest phoenix
earnest phoenix
pine nova
dry imp
#

vanced lame

pine nova
earnest phoenix
pine nova
#

idk

#

i use it

#

💀

earnest phoenix
#

i thought youtube would take action against something that literally destroys their only source of income

pine nova
earnest phoenix
earnest phoenix
#

this knife needs some sharpening

#

Its fbi scret

#

:)

pine nova
earnest phoenix
#

3 months

#

It shouldn't be hard to spend 10 minutes in 3 months

pine nova
#

i listen to music like 5 hours in a day 💀

#

but still after 3 months ads will come back

earnest phoenix
#

Then best idea for you just download musics you listen

pine nova
#

i just downloaded the mod apk works smooth

earnest phoenix
#

sectret

woeful monolith
#

Did you guys noticed? Youtube Music have better quality than Spotify.

wheat mesa
#

I don’t think so

#

YouTube music forces me back to the same 3 songs every time I click on a playlist

pale vessel
#

and YouTube Music just uses YouTube

woeful monolith
pale vessel
#

it does

woeful monolith
#

Lol.

#

Doesn't matter whatever you say.

earnest phoenix
#

You can set your voice quality also

woeful monolith
#

Test it on max quality vs YouTube Music

pine nova
#

youtube music is bad

hybrid cargo
#

Music quality doesnt depend just on the app you are using. It depends on your internet connection, the earphones you are using, your device, and mostly your ears

woeful monolith
#

Spotify uses 320 Kbps MP3 and youtube music uses 256Kbps AAC. But in daily life you will not notice the differences. AAC codec is much better than mp3 and those instrumentals are very clear where Spotify will give a little bit more bass that you will not notice in your everyday life.

hybrid cargo
#

I just need my songs to play while im working. 💀

woeful monolith
#

Just try same song on Spotify and then YouTube Music. Same 30 seconds. You will figure it out.

dry imp
#

damn malik, you really loves songs and frequency huh

hybrid cargo
#

Bro.... like literally

#

😂

#

If im not gonna notice something in my everyday life, im not gonna spend my time trying to notice it

woeful monolith
#

I just noticed. Accidentally because I got premium subscription on both.

wheat mesa
#

I could not possibly care less about the slightly better instrumentals on YouTube music when the automatic playlists there suck ass KEKW

#

It’s like YouTube music is intentionally trying to play my most hated songs on repeat

earnest phoenix
#

Waffle you love those songs secretly dont lie

timber fractal
#

Why do i get this error and how do i fix it? DiscordAPIError: Invalid Form Body 11.options[1].type: This field is required 11.options[2].type: This field is required 11.options[3].type: This field is requiredcode https://srcb.in/qvASF9xatE

lament rock
#

Command options are supposed to have types like STRING or BOOLEAN

daring apex
#

Ha

#

Ruk

lament rock
#

play despacito

#

alternatively, bAgmGZ9iQ2Y

hybrid cargo
ruby geode
#

can someone tell me why I can't see the invite ppl option?

dry imp
#

you dont have the permission to invite people

terse steppe
#

How can i color this buttons and other to a custom color?

pine nova
#

css

terse steppe
#

ik but idk what css it use

#

like i just want to change it color

#

i want to know what class it use

dry imp
#

inspect

pine nova
#

ye inspect

earnest phoenix
#

Can anyone approve my bot

#

@stiff otter can you view my bot

boreal iron
#

Nope you’re in queue and gotta wait like anybody else.

daring apex
#

Bsdk yaha to sudar ja

split hazel
#

you gotta wait like everybody else

#

anyways bye

boreal iron
#

kthxbb

split hazel
#

please stop saying bb it sounds like you're saying baby

slender thistle
#

Okay bb

pine nova
#

bb

lyric mountain
#

something is badly indented

#
if blabla:
<-->another code
<-->another code
<-->another code
<-->else: <------ ERROR
#

bruh, at least give me 10s to read anything

#

red snake = error

finite spoke
#

Oh god

lyric mountain
#

indent

finite spoke
#

This is why I don’t check this channel

lyric mountain
#

your return is at the same level as the previous if

finite spoke
lyric mountain
#

INDENT

finite spoke
#

Learn to code first

#

Ffs

#

Don’t care

#

Learn to code

#

LOL

lyric mountain
#

while that did sound rude, he's right

finite spoke
#

Ok keep getting spooned

lyric mountain
#

you're missing basic python syntax knowledge

#

like, python requires STRICT indentation

#

you need to have a certain indentation inside blocks

boreal iron
#

_that’s why you don’t use a snakish language _

lyric mountain
#
if ...:
TAB code
TAB code
TAB code
TAB return
else:
TAB code
TAB code
#

you can't have```
if ...:
TAB code
TAB code
TAB code
return
else:
TAB code
TAB code

#

cuz the return is misaligned there

#

@earnest phoenix don't simply go away

#

read this ^

slender wagon
#
  • u have to pay
boreal iron
#

run

finite spoke
#

Lmao

lyric mountain
#

I don't get why people jump right into python thinking it's easier

#

I mean, it does LOOK easier, but it's as hard as, say, JS

#

maybe somewhere between lua and js

#

...I pointed where the error is

lyric mountain
trim perch
#

and has most of what an application wants built in

lyric mountain
trim perch
#

as opposed to the point where node.js is javascript

#

sorry ecma!

lyric mountain
#

press tab

#

or whatever u used for indentation

#

whatever u put before the if, put before return

#

be it space, tab, &nbsp, etc

finite spoke
#

On mobile you should use spaces unless you have a special keyboard with a tab key

#

Do you have a computer you can use? If so, it’s easier to use something like vscode, sublime, or atom

#

You get stuff like intellisense

pine nova
#

wait u were coding on mobile?

pine nova
#

and u have a pc with u too?

#

why would u use mobile to code if u have pc pepowot

wintry blade
#

P

#

@danish

opaque acorn
#

anyone know why discord.js upgrades auto in replit?

#

i cant downgrade

split hazel
#

probably because you don't have a specific version set in your package json

spark flint
#

does anyone know how to upload files to scaleway object storage using nodejs

solemn latch
#

I would just use their s3 api

spark flint
#

but i;m getting errors

#

its saying path.replace undefined PepeYikes

earnest phoenix
spark flint
#

even tho its the module returning the replce error

opaque acorn
solemn latch
spark flint
#

It’s the scaleway one

solemn latch
#

I dont know the scaleway library

#

You can use any s3 library if the scaleway library doesn't work

spark flint
#

Alr

surreal sage
#

'Need some help,

Let's say I have this array stored somewhere

[
{
"1": "test",
"2": "yes",
"value": "h"
},
{
"1": "ball",
"2": "pit",
"value": "fun"
}
]```
And then I have a array of message content arguments, how would I search thru the first array if the message includes both of those in 1 of the keys
wheat mesa
#

So you want to see if a message contains test and yes in this case?

surreal sage
#

Yes

#

But there would be more of those keys in the first array

lyric mountain
#

you shouldn't have an object to begin with

#

["test", "yes"]

wheat mesa
#

Yeah from what it looks like you just want an array

#

Those keys are pointless

#

You’d just be adding extra processing time

surreal sage
#

There

#

updated it

wheat mesa
#

Still doesn’t make sense

#

Are the keys important?

surreal sage
#

Yes

wheat mesa
#

What do you want the keys for

surreal sage
#

Alright let me say the point of this

#

I'm making a "ai" bot

#

User sends a dm with their issue

#

The bot looks thru the content

wheat mesa
#

So you want to compare the content with the keys then

#

Not the values

surreal sage
#

Finds for keys that match the content

#

You can ignore "value"

wheat mesa
#

But why do you have an array of objects then

#

Use one object

surreal sage
#

updated it again

wheat mesa
#

I’m still confused

surreal sage
#

So lets grab the first key which "1" & "2"

#

And the message is I like test which yes

#

It should look thru all the args

#

I, like, test, which, yes

#

It should search thru and see if something matches

wheat mesa
#

Use an array, not an object then

surreal sage
#

How would I use it then?

wheat mesa
#

If the array includes something from your message, send whatever it was you were going to send

surreal sage
#

There are going to be 2 arguments that will be used

wheat mesa
#

Then use &&

surreal sage
#

There must be 2 arguments that match*

#

There are going to be more then 2 arguments

wheat mesa
#

I’ve got to go, this sounds like you’re over complicating it. If you’re just grabbing values from an object regardless of keys just to respond once to it then you probably shouldn’t be using an object

lyric mountain
#

what you want to make is a neural network basically

surreal sage
#

cool

lyric mountain
#

cool yes, but there's a reason there's a whole specialization about it

spark flint
#

moved to google cloud storage instead

lyric mountain
#

nice

#

shiro (not the dog)

earnest phoenix
#

Why this reply isnt yellow

lyric mountain
#

did u enable pinging users?

#

ik that's a setting for messages

severe perch
earnest phoenix
#

Itsnt reply

lyric mountain
#

like, u can make a message mention the user but not ping him

earnest phoenix
#

//allowedMentions: { repliedUser: false }

#

You mean that

severe perch
lyric mountain
earnest phoenix
#

Okay i dont have it

#

And in my phone it seems invalid user

lyric mountain
#

bots can mention without pinging

#

even without replying

earnest phoenix
#

But i didnt enable it

#

And this shit drove me crazy

#

I tried everything

#

<@member.id>
member
member.user
member.guild.members.cache.get(member.id)
member.guild.users.cache.get(member.id)

lyric mountain
#

well, I tried to find it in the docs but too lazy to click on all links to find the part about allowed mentions

#

but basically you can disable pinging globally

earnest phoenix
#

And thats not solve of my problem thanks

lyric mountain
#

well, disabled ping WILL make the mention not ping the user

#

but you do you

earnest phoenix
#

where is the error?

#
/workspace/node_modules/discord.js/src/rest/RequestHandler.js:154
throw new DiscordAPIError(request.path, data, request.method, res.status);
^

DiscordAPIError: Invalid Form Body
embed.thumbnail.url: Not a well formed URL.
embeds[0].thumbnail.url: Not a well formed URL.
at RequestHandler.execute (/workspace/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/workspace/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
method: 'post',
path: '/channels/804274092730875904/messages',
code: 50035,
httpStatus: 400
}
boreal iron
#

embeds[0].thumbnail.url: Not a well formed URL.

earnest phoenix
spark flint
#

anyone know how to set Auth keys on Google Cloud storage nodejs module?

earnest phoenix
#

yeah but i have my bot running from 9 days ago and i don't know the error is

lyric mountain
#

where is that error happening?

#

maybe it's a wrong imgur url or null user avatar

boreal iron
timber fractal
lament rock
timber fractal
#

and i fixed it already

#

deleted the command KEKW

pale vessel
#

that's indeed a working solution

slow terrace
#
          const modifier = require(`${process.cwd()}/util/modifier`);

          const message = await modifier.modify(`{user}, Joined the server`, member);
          return client.channels.cache.get(data.greeter.welcome.channel).send(message);

../util/modifier

const moment = require('moment');

async function modify(str, member){

  const modifiers = {
    "{user}": member.user.username,
  };
  const regexp = new RegExp(Object.keys(modifiers).join('|'), 'g');

  return str.replace(regexp, word => {
    return modifiers[word] || word;
  });
};

module.exports = { modify };

user should be the member.user.username but for some reason it's nothing (it was working before!)
any help?

quartz kindle
#

why do you fetch the owner if you dont use it?

lyric mountain
slow terrace
#

By the wrong

slow terrace
#

@lyric mountain I still can't find the problem it looks okay for me

lyric mountain
#

try using replaceAll first, your method is prone to regex injection

slow terrace
#

not working

lyric mountain
#

no

#

read the damn docs

slow terrace
#

kk

half bear
#

how can i send message to a specific channel with channel id (v13 slash commands)

lyric mountain
half bear
#

because i tried that and it doesn't work weirdly.

lyric mountain
#

no

#

guild.channels to get all channels in a guild

#

then either use cache or fetch depending on whether ur caching or not

half bear
#

oh alr its working now

#

thanks

#

btw can we set a minimum integer like 1000000 or something

boreal iron
#

For slash commands? No.

#

The types are very unspecific and I doubt that will change soon.

#

You need to validate the input yourself even if Discord (already) enforces the type.

slow terrace
#

Bruh later i discovered that the problem was from the sentence that stored in the database 😩
Anyway sorry for that and thanks for your helping @lyric mountain

boreal iron
#

Oh I see

#

Thanks, good to know

boreal iron
#

Do you?

split hazel
#

exposing you for late reply

boreal iron
#

I’m working to keep the economy running , Sir!

#

Which means I just randomly open discord if i have time for

split hazel
#

actually i've been quite busy

#

waiting for interview decision for a job and whilst i did i was lining up another job interview in case i get declined from my primary choice

#

im all set

#

now i sit back and relax

dry imp
#

gl speedy

lyric mountain
#

Concatting usernames into regex is dangerous

trim perch
trim perch
#

because if my username is .+ you're not going to have a fun time

boreal iron
trim perch
#

janitor?

lyric mountain
boreal iron
#

lmao

lyric mountain
#

Users could set their username in a way to fck ur code up

#

Read the story of "little bobby tables" and you'll understand

#

Someone grab the xkcd url please

split hazel
#

pfsh

#

regex ddos

#

amateur security vulnerability

trim perch
#

oops wrong one

quartz kindle
#

oh no

#

bobby tables is using log4j

boreal iron
opaque seal
#

I'm using ktor for the web server

#

But it's weird that I get 502

#

it shouldn't be ktor

split hazel
#

you know you're an average java developer when you use log4j instead of your own logging

woeful pike
woeful pike
#

query localhost:11000 through curl on the host machine first

opaque seal
#

on the vps?

woeful pike
#

yes

boreal iron
#

Yes on the local host

opaque seal
#

Uhm weird

#

Ktor not running then

woeful pike
#

yep

#

great webserver choice tho ktor is awesome

opaque seal
#

so weird

#

Yeah I love it tho

#

But

#

Sometimes intellij completely bugs

#

And doesn't analyze code correctly

#

Still unsure whether spring would be better

woeful pike
#

doubt

opaque seal
#

Ktor is quicker for developing maybe idk

#

should try them both first

woeful pike
#

maybe you should fix your server first

opaque seal
#

It's fine

#

it just didn't start

earnest phoenix
#

when will this be updated to 3.10?

pale vessel
#

no maintainer

earnest phoenix
#

hm?

lyric mountain
#

does python break libs every single version?

#

cuz like, shouldn't 3.6 suffice for later versions until 4.0?

dry imp
earnest phoenix
lyric mountain
#

nobody to update it

earnest phoenix
#

wait but doesn't top.gg maintain it?